Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Grégoire Locqueville
purescript-gargantext
Commits
f28f7590
Commit
f28f7590
authored
Jul 07, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] generics types ShareNode
parent
3da0c20f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
10 deletions
+38
-10
Tree.purs
src/Gargantext/Components/Forest/Tree.purs
+3
-3
Action.purs
src/Gargantext/Components/Forest/Tree/Node/Action.purs
+4
-4
Share.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Share.purs
+31
-3
No files found.
src/Gargantext/Components/Forest/Tree.purs
View file @
f28f7590
...
...
@@ -23,7 +23,7 @@ import Gargantext.Components.Forest.Tree.Node.Action.Move (moveNodeReq)
import Gargantext.Components.Forest.Tree.Node.Action.Merge (mergeNodeReq)
import Gargantext.Components.Forest.Tree.Node.Action.Link (linkNodeReq)
import Gargantext.Components.Forest.Tree.Node.Action.Rename (RenameValue(..), rename)
import Gargantext.Components.Forest.Tree.Node.Action.Share
(ShareValue(..), share)
import Gargantext.Components.Forest.Tree.Node.Action.Share
as Share
import Gargantext.Components.Forest.Tree.Node.Action.Update (updateRequest)
import Gargantext.Components.Forest.Tree.Node.Action.Upload (uploadFile)
import Gargantext.Components.Forest.Tree.Node.Tools.FTree (FTree, LNode(..), NTree(..))
...
...
@@ -274,12 +274,12 @@ performAction (RenameNode name) p@{ reload: (_ /\ setReload)
performAction RefreshTree p
-------
performAction (Share
Node
username) p@{ reload: (_ /\ setReload)
performAction (Share
Team
username) p@{ reload: (_ /\ setReload)
, session
, tree: (NTree (LNode {id}) _)
} =
do
void $
share session id $ ShareValue {text:
username}
void $
Share.share session id $ Share.ShareTeam {
username}
-------
performAction (AddNode name nodeType) p@{ openNodes: (_ /\ setOpenNodes)
...
...
src/Gargantext/Components/Forest/Tree/Node/Action.purs
View file @
f28f7590
...
...
@@ -23,7 +23,7 @@ data Action = AddNode String GT.NodeType
| DeleteNode
| RenameNode String
| UpdateNode UpdateNodeParams
| Share
Node
String
| Share
Team
String
| DoSearch GT.AsyncTaskWithType
| UploadFile GT.NodeType FileType (Maybe String) UploadFileContents
| DownloadNode
...
...
@@ -54,7 +54,7 @@ instance showShow :: Show Action where
show DeleteNode = "DeleteNode"
show (RenameNode _ )= "RenameNode"
show (UpdateNode _ )= "UpdateNode"
show (Share
Node _ )= "ShareNode
"
show (Share
Team _ )= "ShareTeam
"
show (DoSearch _ )= "SearchQuery"
show (UploadFile _ _ _ _)= "UploadFile"
show RefreshTree = "RefreshTree"
...
...
@@ -70,7 +70,7 @@ icon (AddNode _ _) = glyphiconNodeAction (Add [])
icon DeleteNode = glyphiconNodeAction Delete
icon (RenameNode _) = glyphiconNodeAction Config
icon (UpdateNode _) = glyphiconNodeAction Refresh
icon (Share
Node
_) = glyphiconNodeAction Share
icon (Share
Team
_) = glyphiconNodeAction Share
icon (DoSearch _) = glyphiconNodeAction SearchBox
icon (UploadFile _ _ _ _) = glyphiconNodeAction Upload
icon RefreshTree = glyphiconNodeAction Refresh
...
...
@@ -88,7 +88,7 @@ text (AddNode _ _ )= "Add !"
text DeleteNode = "Delete !"
text (RenameNode _ )= "Rename !"
text (UpdateNode _ )= "Update !"
text (Share
Node
_ )= "Share !"
text (Share
Team
_ )= "Share !"
text (DoSearch _ )= "Launch search !"
text (UploadFile _ _ _ _)= "Upload File !"
text RefreshTree = "Refresh Tree !"
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Share.purs
View file @
f28f7590
...
...
@@ -5,20 +5,29 @@ import Data.Maybe (Maybe(..))
import Effect.Aff (Aff)
import Prelude (($))
import Reactix as R
import Gargantext.Components.Forest.Tree.Node.Action
import Gargantext.Components.Forest.Tree.Node.Action (Action)
import Gargantext.Components.Forest.Tree.Node.Action as Action
import Gargantext.Types as GT
import Gargantext.Types (ID)
import Gargantext.Routes as GR
import Gargantext.Sessions (Session, post)
import Gargantext.Components.Forest.Tree.Node.Tools as Tools
import Data.Argonaut as Argonaut
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Show (genericShow)
import Gargantext.Utils.Argonaut (genericSumDecodeJson, genericSumEncodeJson, genericEnumDecodeJson, genericEnumEncodeJson)
import Data.Maybe (Maybe(..))
import Gargantext.Prelude (class Eq, class Read, class Show)
------------------------------------------------------------------------
share :: Session -> ID -> Share
Value -> Aff (Array ID)
share :: Session -> ID -> Share
Node -> Aff ID
share session nodeId =
post session $ GR.NodeAPI GT.Node (Just nodeId) "share"
shareAction :: String -> Action
shareAction username =
ShareNode
username
shareAction username =
Action.ShareTeam
username
------------------------------------------------------------------------
newtype ShareValue = ShareValue
...
...
@@ -33,3 +42,22 @@ instance encodeJsonShareValue :: EncodeJson ShareValue where
textInputBox :: Record Tools.TextInputBoxProps -> R.Element
textInputBox = Tools.textInputBox
------------------------------------------------------------------------
data ShareNode = ShareTeam { username :: String }
| SharePublic { rights :: String }
derive instance eqShareNode :: Eq ShareNode
derive instance genericShareNode :: Generic ShareNode _
instance showShareNode :: Show ShareNode where
show = genericShow
instance decodeJsonShareNode :: Argonaut.DecodeJson ShareNode where
decodeJson = genericSumDecodeJson
instance encodeJsonShareNode :: Argonaut.EncodeJson ShareNode where
encodeJson = genericSumEncodeJson
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment