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
Hide 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
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.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.Tools.FTree (FTree, LNode(..), NTree(..), ID, fTreeID)
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
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.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.SubTree.Types (SubTreeOut(..))
import Gargantext.Config.REST (RESTError)
...
...
@@ -308,6 +309,11 @@ linkNode nodeType params p@{ boxes: { errors }, session } = traverse_ f params w
handleRESTError errors eTask $ \_task -> pure unit
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
-- | application. we should slowly get rid of it.
performAction :: Action -> Record PerformActionProps -> Aff Unit
...
...
@@ -329,5 +335,6 @@ performAction (MoveNode {params}) p = moveNode params
performAction (MergeNode {params}) p = mergeNode params p
performAction (LinkNode { nodeType, params }) p = linkNode nodeType params p
performAction RefreshTree p = refreshTree p
performAction NoAction _ = liftEffect $ here.log "[performAction] NoAction"
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
icon (MoveNode _ ) = glyphiconNodeAction (Move { subTreeParams : SubTreeParams {showtypes:[], valitypes:[] }})
icon (MergeNode _ ) = glyphiconNodeAction (Merge { subTreeParams : SubTreeParams {showtypes:[], valitypes:[] }})
icon (LinkNode _ ) = glyphiconNodeAction (Link { subTreeParams : SubTreeParams {showtypes:[], valitypes:[] }})
icon (DocumentsFromWriteNodes _) = glyphiconNodeAction (WriteNodesDocuments)
icon NoAction = "hand-o-right"
...
...
@@ -74,6 +75,7 @@ text DownloadNode = "Download !"
text (MoveNode _ ) = "Move !"
text (MergeNode _ ) = "Merge !"
text (LinkNode _ ) = "Link !"
text (DocumentsFromWriteNodes _ ) = "Documents from Write Nodes !"
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
| MergeNode {params :: Maybe SubTreeOut}
| LinkNode {nodeType :: Maybe GT.NodeType, params :: Maybe SubTreeOut}
| DocumentsFromWriteNodes { id :: GT.ID }
| NoAction
derive instance Generic Action _
...
...
@@ -53,6 +55,7 @@ instance Eq Action where
eq (MoveNode p1) (MoveNode p2) = eq p1 p2
eq (MergeNode p1) (MergeNode p2) = eq p1 p2
eq (LinkNode l1) (LinkNode l2) = eq l1 l2
eq (DocumentsFromWriteNodes { id: id1 }) (DocumentsFromWriteNodes { id: id2 }) = eq id1 id2
eq NoAction NoAction = true
eq _ _ = false
...
...
@@ -74,4 +77,5 @@ instance Show Action where
show (MoveNode _ ) = "MoveNode"
show (MergeNode _ ) = "MergeNode"
show (LinkNode _ ) = "LinkNode"
show (DocumentsFromWriteNodes _ ) = "DocumentsFromWriteNodes"
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
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.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.Settings (NodeAction(..), SettingsBox(..), glyphiconNodeAction, settingsBox)
import Gargantext.Components.Forest.Tree.Node.Status (Status(..), hasStatus)
...
...
@@ -203,4 +204,6 @@ panelActionCpt = here.component "panelAction" cpt
pure $ Share.publishNode { boxes, dispatch, id, nodeType, session, subTreeParams } []
cpt { action: SearchBox, boxes, dispatch, 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 {} []
src/Gargantext/Components/Forest/Tree/Node/Settings.purs
View file @
4f0fa038
...
...
@@ -24,62 +24,66 @@ data NodeAction = Documentation NodeType
| Clone
| AddingContact
| CloseNodePopover
| WriteNodesDocuments -- https://gitlab.iscpif.fr/gargantext/purescript-gargantext/issues/331
------------------------------------------------------------------------
instance Eq NodeAction where
eq (Documentation x) (Documentation y) = true && (x == y)
eq SearchBox SearchBox = true
eq Download Download = true
eq Upload Upload = true
eq Refresh Refresh = true
eq (Move x) (Move y) = x == y
eq Clone Clone = true
eq Delete Delete = true
eq Share Share = true
eq (Link x) (Link y) = x == y
eq (Add x) (Add y) = x == y
eq (Merge x) (Merge y) = x == y
eq Config Config = true
eq (Publish x) (Publish y) = x == y
eq AddingContact AddingContact = true
eq CloseNodePopover CloseNodePopover = true
eq _ _ = false
eq (Documentation x) (Documentation y) = true && (x == y)
eq SearchBox SearchBox = true
eq Download Download = true
eq Upload Upload = true
eq Refresh Refresh = true
eq (Move x) (Move y) = x == y
eq Clone Clone = true
eq Delete Delete = true
eq Share Share = true
eq (Link x) (Link y) = x == y
eq (Add x) (Add y) = x == y
eq (Merge x) (Merge y) = x == y
eq Config Config = true
eq (Publish x) (Publish y) = x == y
eq AddingContact AddingContact = true
eq CloseNodePopover CloseNodePopover = true
eq WriteNodesDocuments WriteNodesDocuments = true
eq _ _ = false
instance Show NodeAction where
show (Documentation x) = "Documentation of " <> show x
show SearchBox = "SearchBox"
show Download = "Download"
show Upload = "Upload"
show Refresh = "Refresh"
show (Move _) = "Move with subtree params" -- <> show t
show Clone = "Clone"
show Delete = "Delete"
show Share = "Share"
show Config = "Config"
show (Link _) = "Link to " -- <> show x
show (Add _) = "Add Child" -- foldl (\a b -> a <> show b) "Add " xs
show (Merge _) = "Merge with subtree" -- <> show t
show (Publish _) = "Publish" -- <> show x
show AddingContact = "AddingContact"
show CloseNodePopover = "CloseNodePopover"
show (Documentation x) = "Documentation of " <> show x
show SearchBox = "SearchBox"
show Download = "Download"
show Upload = "Upload"
show Refresh = "Refresh"
show (Move _) = "Move with subtree params" -- <> show t
show Clone = "Clone"
show Delete = "Delete"
show Share = "Share"
show Config = "Config"
show (Link _) = "Link to " -- <> show x
show (Add _) = "Add Child" -- foldl (\a b -> a <> show b) "Add " xs
show (Merge _) = "Merge with subtree" -- <> show t
show (Publish _) = "Publish" -- <> show x
show AddingContact = "AddingContact"
show CloseNodePopover = "CloseNodePopover"
show WriteNodesDocuments = "WriteNodesDocuments"
glyphiconNodeAction :: NodeAction -> String
glyphiconNodeAction (Documentation _) = "question-circle"
glyphiconNodeAction Delete = "trash"
glyphiconNodeAction (Add _) = "plus"
glyphiconNodeAction SearchBox = "search"
glyphiconNodeAction Upload = "upload"
glyphiconNodeAction (Link _) = "arrows-h"
glyphiconNodeAction Download = "download"
glyphiconNodeAction (Merge _) = "random"
glyphiconNodeAction Refresh = "refresh"
glyphiconNodeAction Config = "wrench"
glyphiconNodeAction Share = "user-plus"
glyphiconNodeAction AddingContact = "user-plus"
glyphiconNodeAction (Move _) = "share-square-o"
glyphiconNodeAction (Publish _) = fldr FolderPublic true
glyphiconNodeAction CloseNodePopover = "close"
glyphiconNodeAction _ = ""
glyphiconNodeAction (Documentation _) = "question-circle"
glyphiconNodeAction Delete = "trash"
glyphiconNodeAction (Add _) = "plus"
glyphiconNodeAction SearchBox = "search"
glyphiconNodeAction Upload = "upload"
glyphiconNodeAction (Link _) = "arrows-h"
glyphiconNodeAction Download = "download"
glyphiconNodeAction (Merge _) = "random"
glyphiconNodeAction Refresh = "refresh"
glyphiconNodeAction Config = "wrench"
glyphiconNodeAction Share = "user-plus"
glyphiconNodeAction AddingContact = "user-plus"
glyphiconNodeAction (Move _) = "share-square-o"
glyphiconNodeAction (Publish _) = fldr FolderPublic true
glyphiconNodeAction CloseNodePopover = "close"
glyphiconNodeAction WriteNodesDocuments = "bars"
glyphiconNodeAction _ = ""
------------------------------------------------------------------------
data SettingsBox =
...
...
@@ -186,6 +190,7 @@ settingsBox Corpus =
]
, Link (linkParams Annuaire)
, Move moveParameters
, WriteNodesDocuments
, Delete
]
}
...
...
@@ -359,9 +364,6 @@ settingsBox NodeFrameVisio =
}
settingsBox NodeFile =
SettingsBox { show: 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