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
99a19646
Commit
99a19646
authored
Jul 07, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] generics types ShareNode
parent
9e9f2004
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
10 deletions
+36
-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
+29
-3
No files found.
src/Gargantext/Components/Forest/Tree.purs
View file @
99a19646
...
@@ -23,7 +23,7 @@ import Gargantext.Components.Forest.Tree.Node.Action.Move (moveNodeReq)
...
@@ -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.Merge (mergeNodeReq)
import Gargantext.Components.Forest.Tree.Node.Action.Link (linkNodeReq)
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.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.Update (updateRequest)
import Gargantext.Components.Forest.Tree.Node.Action.Upload (uploadFile)
import Gargantext.Components.Forest.Tree.Node.Action.Upload (uploadFile)
import Gargantext.Components.Forest.Tree.Node.Tools.FTree (FTree, LNode(..), NTree(..))
import Gargantext.Components.Forest.Tree.Node.Tools.FTree (FTree, LNode(..), NTree(..))
...
@@ -274,12 +274,12 @@ performAction (RenameNode name) p@{ reload: (_ /\ setReload)
...
@@ -274,12 +274,12 @@ performAction (RenameNode name) p@{ reload: (_ /\ setReload)
performAction RefreshTree p
performAction RefreshTree p
-------
-------
performAction (Share
Node
username) p@{ reload: (_ /\ setReload)
performAction (Share
Team
username) p@{ reload: (_ /\ setReload)
, session
, session
, tree: (NTree (LNode {id}) _)
, tree: (NTree (LNode {id}) _)
} =
} =
do
do
void $
share session id $ ShareValue {text:
username}
void $
Share.share session id $ Share.ShareTeam {
username}
-------
-------
performAction (AddNode name nodeType) p@{ openNodes: (_ /\ setOpenNodes)
performAction (AddNode name nodeType) p@{ openNodes: (_ /\ setOpenNodes)
...
...
src/Gargantext/Components/Forest/Tree/Node/Action.purs
View file @
99a19646
...
@@ -23,7 +23,7 @@ data Action = AddNode String GT.NodeType
...
@@ -23,7 +23,7 @@ data Action = AddNode String GT.NodeType
| DeleteNode
| DeleteNode
| RenameNode String
| RenameNode String
| UpdateNode UpdateNodeParams
| UpdateNode UpdateNodeParams
| Share
Node
String
| Share
Team
String
| DoSearch GT.AsyncTaskWithType
| DoSearch GT.AsyncTaskWithType
| UploadFile GT.NodeType FileType (Maybe String) UploadFileContents
| UploadFile GT.NodeType FileType (Maybe String) UploadFileContents
| DownloadNode
| DownloadNode
...
@@ -54,7 +54,7 @@ instance showShow :: Show Action where
...
@@ -54,7 +54,7 @@ instance showShow :: Show Action where
show DeleteNode = "DeleteNode"
show DeleteNode = "DeleteNode"
show (RenameNode _ )= "RenameNode"
show (RenameNode _ )= "RenameNode"
show (UpdateNode _ )= "UpdateNode"
show (UpdateNode _ )= "UpdateNode"
show (Share
Node _ )= "ShareNode
"
show (Share
Team _ )= "ShareTeam
"
show (DoSearch _ )= "SearchQuery"
show (DoSearch _ )= "SearchQuery"
show (UploadFile _ _ _ _)= "UploadFile"
show (UploadFile _ _ _ _)= "UploadFile"
show RefreshTree = "RefreshTree"
show RefreshTree = "RefreshTree"
...
@@ -70,7 +70,7 @@ icon (AddNode _ _) = glyphiconNodeAction (Add [])
...
@@ -70,7 +70,7 @@ icon (AddNode _ _) = glyphiconNodeAction (Add [])
icon DeleteNode = glyphiconNodeAction Delete
icon DeleteNode = glyphiconNodeAction Delete
icon (RenameNode _) = glyphiconNodeAction Config
icon (RenameNode _) = glyphiconNodeAction Config
icon (UpdateNode _) = glyphiconNodeAction Refresh
icon (UpdateNode _) = glyphiconNodeAction Refresh
icon (Share
Node
_) = glyphiconNodeAction Share
icon (Share
Team
_) = glyphiconNodeAction Share
icon (DoSearch _) = glyphiconNodeAction SearchBox
icon (DoSearch _) = glyphiconNodeAction SearchBox
icon (UploadFile _ _ _ _) = glyphiconNodeAction Upload
icon (UploadFile _ _ _ _) = glyphiconNodeAction Upload
icon RefreshTree = glyphiconNodeAction Refresh
icon RefreshTree = glyphiconNodeAction Refresh
...
@@ -88,7 +88,7 @@ text (AddNode _ _ )= "Add !"
...
@@ -88,7 +88,7 @@ text (AddNode _ _ )= "Add !"
text DeleteNode = "Delete !"
text DeleteNode = "Delete !"
text (RenameNode _ )= "Rename !"
text (RenameNode _ )= "Rename !"
text (UpdateNode _ )= "Update !"
text (UpdateNode _ )= "Update !"
text (Share
Node
_ )= "Share !"
text (Share
Team
_ )= "Share !"
text (DoSearch _ )= "Launch search !"
text (DoSearch _ )= "Launch search !"
text (UploadFile _ _ _ _)= "Upload File !"
text (UploadFile _ _ _ _)= "Upload File !"
text RefreshTree = "Refresh Tree !"
text RefreshTree = "Refresh Tree !"
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Share.purs
View file @
99a19646
...
@@ -5,20 +5,29 @@ import Data.Maybe (Maybe(..))
...
@@ -5,20 +5,29 @@ import Data.Maybe (Maybe(..))
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Prelude (($))
import Prelude (($))
import Reactix as R
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 as GT
import Gargantext.Types (ID)
import Gargantext.Types (ID)
import Gargantext.Routes as GR
import Gargantext.Routes as GR
import Gargantext.Sessions (Session, post)
import Gargantext.Sessions (Session, post)
import Gargantext.Components.Forest.Tree.Node.Tools as Tools
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 =
share session nodeId =
post session $ GR.NodeAPI GT.Node (Just nodeId) "share"
post session $ GR.NodeAPI GT.Node (Just nodeId) "share"
shareAction :: String -> Action
shareAction :: String -> Action
shareAction username =
ShareNode
username
shareAction username =
Action.ShareTeam
username
------------------------------------------------------------------------
------------------------------------------------------------------------
newtype ShareValue = ShareValue
newtype ShareValue = ShareValue
...
@@ -33,3 +42,20 @@ instance encodeJsonShareValue :: EncodeJson ShareValue where
...
@@ -33,3 +42,20 @@ instance encodeJsonShareValue :: EncodeJson ShareValue where
textInputBox :: Record Tools.TextInputBoxProps -> R.Element
textInputBox :: Record Tools.TextInputBoxProps -> R.Element
textInputBox = Tools.textInputBox
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