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
4f0fa038
Commit
4f0fa038
authored
Sep 28, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[write nodes] frontend work for adding write nodes to corpus
This is currently added only to settings of a corpus.
parent
c7509c3a
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
122 additions
and
53 deletions
+122
-53
FolderView.purs
src/Gargantext/Components/FolderView.purs
+1
-0
Tree.purs
src/Gargantext/Components/Forest/Tree.purs
+8
-1
Action.purs
src/Gargantext/Components/Forest/Tree/Node/Action.purs
+2
-0
Types.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Types.purs
+4
-0
WriteNodesDocuments.purs
...mponents/Forest/Tree/Node/Action/WriteNodesDocuments.purs
+50
-0
Box.purs
src/Gargantext/Components/Forest/Tree/Node/Box.purs
+3
-0
Settings.purs
src/Gargantext/Components/Forest/Tree/Node/Settings.purs
+54
-52
No files found.
src/Gargantext/Components/FolderView.purs
View file @
4f0fa038
...
@@ -26,6 +26,7 @@ import Gargantext.Components.Forest.Tree.Node.Action.Share as Share
...
@@ -26,6 +26,7 @@ import Gargantext.Components.Forest.Tree.Node.Action.Share as Share
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..))
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 (uploadArbitraryFile, uploadFile)
import Gargantext.Components.Forest.Tree.Node.Action.Upload (uploadArbitraryFile, uploadFile)
import Gargantext.Components.Forest.Tree.Node.Action.WriteNodesDocuments (documentsFromWriteNodesReq)
import Gargantext.Components.Forest.Tree.Node.Box (nodePopupView)
import Gargantext.Components.Forest.Tree.Node.Box (nodePopupView)
import Gargantext.Components.Forest.Tree.Node.Tools.FTree (FTree, LNode(..), NTree(..), ID, fTreeID)
import Gargantext.Components.Forest.Tree.Node.Tools.FTree (FTree, LNode(..), NTree(..), ID, fTreeID)
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree.Types (SubTreeOut(..))
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree.Types (SubTreeOut(..))
...
...
src/Gargantext/Components/Forest/Tree.purs
View file @
4f0fa038
...
@@ -23,6 +23,7 @@ import Gargantext.Components.Forest.Tree.Node.Action.Share as Share
...
@@ -23,6 +23,7 @@ import Gargantext.Components.Forest.Tree.Node.Action.Share as Share
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..))
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, uploadArbitraryFile, uploadFrameCalc)
import Gargantext.Components.Forest.Tree.Node.Action.Upload (uploadFile, uploadArbitraryFile, uploadFrameCalc)
import Gargantext.Components.Forest.Tree.Node.Action.WriteNodesDocuments (documentsFromWriteNodesReq)
import Gargantext.Components.Forest.Tree.Node.Tools.FTree (FTree, LNode(..), NTree(..), fTreeID)
import Gargantext.Components.Forest.Tree.Node.Tools.FTree (FTree, LNode(..), NTree(..), fTreeID)
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree.Types (SubTreeOut(..))
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree.Types (SubTreeOut(..))
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (RESTError)
...
@@ -308,6 +309,11 @@ linkNode nodeType params p@{ boxes: { errors }, session } = traverse_ f params w
...
@@ -308,6 +309,11 @@ linkNode nodeType params p@{ boxes: { errors }, session } = traverse_ f params w
handleRESTError errors eTask $ \_task -> pure unit
handleRESTError errors eTask $ \_task -> pure unit
refreshTree p
refreshTree p
documentsFromWriteNodes id p@{ boxes: { errors }, session } = do
eTask <- documentsFromWriteNodesReq session id
handleRESTError errors eTask $ \_task -> pure unit
refreshTree p
-- | This thing is basically a hangover from when garg was a thermite
-- | This thing is basically a hangover from when garg was a thermite
-- | application. we should slowly get rid of it.
-- | application. we should slowly get rid of it.
performAction :: Action -> Record PerformActionProps -> Aff Unit
performAction :: Action -> Record PerformActionProps -> Aff Unit
...
@@ -329,5 +335,6 @@ performAction (MoveNode {params}) p = moveNode params
...
@@ -329,5 +335,6 @@ performAction (MoveNode {params}) p = moveNode params
performAction (MergeNode {params}) p = mergeNode params p
performAction (MergeNode {params}) p = mergeNode params p
performAction (LinkNode { nodeType, params }) p = linkNode nodeType params p
performAction (LinkNode { nodeType, params }) p = linkNode nodeType params p
performAction RefreshTree p = refreshTree p
performAction RefreshTree p = refreshTree p
performAction NoAction _ = liftEffect $ here.log "[performAction] NoAction"
performAction ClosePopover p = closePopover p
performAction ClosePopover p = closePopover p
performAction (DocumentsFromWriteNodes { id }) p = documentsFromWriteNodes id p
performAction NoAction _ = liftEffect $ here.log "[performAction] NoAction"
src/Gargantext/Components/Forest/Tree/Node/Action.purs
View file @
4f0fa038
...
@@ -51,6 +51,7 @@ icon DownloadNode = glyphiconNodeAction Download
...
@@ -51,6 +51,7 @@ icon DownloadNode = glyphiconNodeAction Download
icon (MoveNode _ ) = glyphiconNodeAction (Move { subTreeParams : SubTreeParams {showtypes:[], valitypes:[] }})
icon (MoveNode _ ) = glyphiconNodeAction (Move { subTreeParams : SubTreeParams {showtypes:[], valitypes:[] }})
icon (MergeNode _ ) = glyphiconNodeAction (Merge { subTreeParams : SubTreeParams {showtypes:[], valitypes:[] }})
icon (MergeNode _ ) = glyphiconNodeAction (Merge { subTreeParams : SubTreeParams {showtypes:[], valitypes:[] }})
icon (LinkNode _ ) = glyphiconNodeAction (Link { subTreeParams : SubTreeParams {showtypes:[], valitypes:[] }})
icon (LinkNode _ ) = glyphiconNodeAction (Link { subTreeParams : SubTreeParams {showtypes:[], valitypes:[] }})
icon (DocumentsFromWriteNodes _) = glyphiconNodeAction (WriteNodesDocuments)
icon NoAction = "hand-o-right"
icon NoAction = "hand-o-right"
...
@@ -74,6 +75,7 @@ text DownloadNode = "Download !"
...
@@ -74,6 +75,7 @@ text DownloadNode = "Download !"
text (MoveNode _ ) = "Move !"
text (MoveNode _ ) = "Move !"
text (MergeNode _ ) = "Merge !"
text (MergeNode _ ) = "Merge !"
text (LinkNode _ ) = "Link !"
text (LinkNode _ ) = "Link !"
text (DocumentsFromWriteNodes _ ) = "Documents from Write Nodes !"
text NoAction = "No Action"
text NoAction = "No Action"
-----------------------------------------------------------------------
-----------------------------------------------------------------------
src/Gargantext/Components/Forest/Tree/Node/Action/Types.purs
View file @
4f0fa038
...
@@ -30,6 +30,8 @@ data Action = AddNode String GT.NodeType
...
@@ -30,6 +30,8 @@ data Action = AddNode String GT.NodeType
| MergeNode {params :: Maybe SubTreeOut}
| MergeNode {params :: Maybe SubTreeOut}
| LinkNode {nodeType :: Maybe GT.NodeType, params :: Maybe SubTreeOut}
| LinkNode {nodeType :: Maybe GT.NodeType, params :: Maybe SubTreeOut}
| DocumentsFromWriteNodes { id :: GT.ID }
| NoAction
| NoAction
derive instance Generic Action _
derive instance Generic Action _
...
@@ -53,6 +55,7 @@ instance Eq Action where
...
@@ -53,6 +55,7 @@ instance Eq Action where
eq (MoveNode p1) (MoveNode p2) = eq p1 p2
eq (MoveNode p1) (MoveNode p2) = eq p1 p2
eq (MergeNode p1) (MergeNode p2) = eq p1 p2
eq (MergeNode p1) (MergeNode p2) = eq p1 p2
eq (LinkNode l1) (LinkNode l2) = eq l1 l2
eq (LinkNode l1) (LinkNode l2) = eq l1 l2
eq (DocumentsFromWriteNodes { id: id1 }) (DocumentsFromWriteNodes { id: id2 }) = eq id1 id2
eq NoAction NoAction = true
eq NoAction NoAction = true
eq _ _ = false
eq _ _ = false
...
@@ -74,4 +77,5 @@ instance Show Action where
...
@@ -74,4 +77,5 @@ instance Show Action where
show (MoveNode _ ) = "MoveNode"
show (MoveNode _ ) = "MoveNode"
show (MergeNode _ ) = "MergeNode"
show (MergeNode _ ) = "MergeNode"
show (LinkNode _ ) = "LinkNode"
show (LinkNode _ ) = "LinkNode"
show (DocumentsFromWriteNodes _ ) = "DocumentsFromWriteNodes"
show NoAction = "NoAction"
show NoAction = "NoAction"
src/Gargantext/Components/Forest/Tree/Node/Action/WriteNodesDocuments.purs
0 → 100644
View file @
4f0fa038
module Gargantext.Components.Forest.Tree.Node.Action.WriteNodesDocuments where
import Gargantext.Prelude
import Data.Either (Either)
import Data.Maybe (Maybe(..))
import Effect.Aff (Aff)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..))
import Gargantext.Components.Forest.Tree.Node.Tools (panel, submitButton)
import Gargantext.Config.REST (RESTError)
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, post)
import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix.DOM.HTML as H
here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.WriteNodesDocuments"
-- | Action : WriteNodesDocuments
type ActionWriteNodesDocuments =
( boxes :: Boxes
, dispatch :: Action -> Aff Unit
, id :: GT.ID
, session :: Session )
actionWriteNodesDocuments :: R2.Component ActionWriteNodesDocuments
actionWriteNodesDocuments = R.createElement actionWriteNodesDocumentsCpt
actionWriteNodesDocumentsCpt :: R.Component ActionWriteNodesDocuments
actionWriteNodesDocumentsCpt = here.component "actionWriteNodesDocuments" cpt where
cpt { boxes, dispatch, id, session } _ = do
let bodies =
[ R2.row
[ H.div { className: "col-12 flex-space-around" }
[ H.div { className: "form-group" }
[ H.text "Will traverse all Write Nodes and insert them as documents into current corpus." ]
]
]
]
pure $ panel bodies (submitButton (DocumentsFromWriteNodes { id }) dispatch)
documentsFromWriteNodesReq :: Session -> GT.ID -> Aff (Either RESTError GT.AsyncTaskWithType)
documentsFromWriteNodesReq session id = do
eTask :: Either RESTError GT.AsyncTask <-
post session (NodeAPI GT.Node (Just id) "documents-from-write-nodes") { id }
pure $ (\task -> GT.AsyncTaskWithType { task, typ: GT.UpdateNode }) <$> eTask
src/Gargantext/Components/Forest/Tree/Node/Box.purs
View file @
4f0fa038
...
@@ -24,6 +24,7 @@ import Gargantext.Components.Forest.Tree.Node.Action.Share as Share
...
@@ -24,6 +24,7 @@ import Gargantext.Components.Forest.Tree.Node.Action.Share as Share
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action)
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action)
import Gargantext.Components.Forest.Tree.Node.Action.Update (update)
import Gargantext.Components.Forest.Tree.Node.Action.Update (update)
import Gargantext.Components.Forest.Tree.Node.Action.Upload (actionUpload)
import Gargantext.Components.Forest.Tree.Node.Action.Upload (actionUpload)
import Gargantext.Components.Forest.Tree.Node.Action.WriteNodesDocuments (actionWriteNodesDocuments)
import Gargantext.Components.Forest.Tree.Node.Box.Types (NodePopupProps, NodePopupS)
import Gargantext.Components.Forest.Tree.Node.Box.Types (NodePopupProps, NodePopupS)
import Gargantext.Components.Forest.Tree.Node.Settings (NodeAction(..), SettingsBox(..), glyphiconNodeAction, settingsBox)
import Gargantext.Components.Forest.Tree.Node.Settings (NodeAction(..), SettingsBox(..), glyphiconNodeAction, settingsBox)
import Gargantext.Components.Forest.Tree.Node.Status (Status(..), hasStatus)
import Gargantext.Components.Forest.Tree.Node.Status (Status(..), hasStatus)
...
@@ -203,4 +204,6 @@ panelActionCpt = here.component "panelAction" cpt
...
@@ -203,4 +204,6 @@ panelActionCpt = here.component "panelAction" cpt
pure $ Share.publishNode { boxes, dispatch, id, nodeType, session, subTreeParams } []
pure $ Share.publishNode { boxes, dispatch, id, nodeType, session, subTreeParams } []
cpt { action: SearchBox, boxes, dispatch, id, session } _ =
cpt { action: SearchBox, boxes, dispatch, id, session } _ =
pure $ actionSearch { boxes, dispatch, id: Just id, session } []
pure $ actionSearch { boxes, dispatch, id: Just id, session } []
cpt { action: WriteNodesDocuments, boxes, dispatch, id, session } _ =
pure $ actionWriteNodesDocuments { boxes, dispatch, id, session } []
cpt _ _ = pure $ H.div {} []
cpt _ _ = pure $ H.div {} []
src/Gargantext/Components/Forest/Tree/Node/Settings.purs
View file @
4f0fa038
...
@@ -24,6 +24,7 @@ data NodeAction = Documentation NodeType
...
@@ -24,6 +24,7 @@ data NodeAction = Documentation NodeType
| Clone
| Clone
| AddingContact
| AddingContact
| CloseNodePopover
| CloseNodePopover
| WriteNodesDocuments -- https://gitlab.iscpif.fr/gargantext/purescript-gargantext/issues/331
------------------------------------------------------------------------
------------------------------------------------------------------------
instance Eq NodeAction where
instance Eq NodeAction where
...
@@ -43,6 +44,7 @@ instance Eq NodeAction where
...
@@ -43,6 +44,7 @@ instance Eq NodeAction where
eq (Publish x) (Publish y) = x == y
eq (Publish x) (Publish y) = x == y
eq AddingContact AddingContact = true
eq AddingContact AddingContact = true
eq CloseNodePopover CloseNodePopover = true
eq CloseNodePopover CloseNodePopover = true
eq WriteNodesDocuments WriteNodesDocuments = true
eq _ _ = false
eq _ _ = false
instance Show NodeAction where
instance Show NodeAction where
...
@@ -62,6 +64,7 @@ instance Show NodeAction where
...
@@ -62,6 +64,7 @@ instance Show NodeAction where
show (Publish _) = "Publish" -- <> show x
show (Publish _) = "Publish" -- <> show x
show AddingContact = "AddingContact"
show AddingContact = "AddingContact"
show CloseNodePopover = "CloseNodePopover"
show CloseNodePopover = "CloseNodePopover"
show WriteNodesDocuments = "WriteNodesDocuments"
glyphiconNodeAction :: NodeAction -> String
glyphiconNodeAction :: NodeAction -> String
glyphiconNodeAction (Documentation _) = "question-circle"
glyphiconNodeAction (Documentation _) = "question-circle"
...
@@ -79,6 +82,7 @@ glyphiconNodeAction AddingContact = "user-plus"
...
@@ -79,6 +82,7 @@ glyphiconNodeAction AddingContact = "user-plus"
glyphiconNodeAction (Move _) = "share-square-o"
glyphiconNodeAction (Move _) = "share-square-o"
glyphiconNodeAction (Publish _) = fldr FolderPublic true
glyphiconNodeAction (Publish _) = fldr FolderPublic true
glyphiconNodeAction CloseNodePopover = "close"
glyphiconNodeAction CloseNodePopover = "close"
glyphiconNodeAction WriteNodesDocuments = "bars"
glyphiconNodeAction _ = ""
glyphiconNodeAction _ = ""
------------------------------------------------------------------------
------------------------------------------------------------------------
...
@@ -186,6 +190,7 @@ settingsBox Corpus =
...
@@ -186,6 +190,7 @@ settingsBox Corpus =
]
]
, Link (linkParams Annuaire)
, Link (linkParams Annuaire)
, Move moveParameters
, Move moveParameters
, WriteNodesDocuments
, Delete
, Delete
]
]
}
}
...
@@ -359,9 +364,6 @@ settingsBox NodeFrameVisio =
...
@@ -359,9 +364,6 @@ settingsBox NodeFrameVisio =
}
}
settingsBox NodeFile =
settingsBox NodeFile =
SettingsBox { show: true
SettingsBox { show: true
, edit: true
, edit: true
...
...
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