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
eae47cff
Commit
eae47cff
authored
Jun 24, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[REFACT] SubTree (WIP).
parent
deb1a1b9
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
25 deletions
+37
-25
Tree.purs
src/Gargantext/Components/Forest/Tree.purs
+2
-2
Move.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Move.purs
+7
-5
Box.purs
src/Gargantext/Components/Forest/Tree/Node/Box.purs
+8
-4
Settings.purs
src/Gargantext/Components/Forest/Tree/Node/Settings.purs
+1
-1
SubTree.purs
...Gargantext/Components/Forest/Tree/Node/Tools/SubTree.purs
+19
-13
No files found.
src/Gargantext/Components/Forest/Tree.purs
View file @
eae47cff
...
@@ -13,7 +13,7 @@ import Gargantext.Components.Forest.Tree.Node (nodeMainSpan)
...
@@ -13,7 +13,7 @@ import Gargantext.Components.Forest.Tree.Node (nodeMainSpan)
import Gargantext.Components.Forest.Tree.Node.Action (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action.Add (AddNodeValue(..), addNode)
import Gargantext.Components.Forest.Tree.Node.Action.Add (AddNodeValue(..), addNode)
import Gargantext.Components.Forest.Tree.Node.Action.Delete (deleteNode)
import Gargantext.Components.Forest.Tree.Node.Action.Delete (deleteNode)
import Gargantext.Components.Forest.Tree.Node.Action.Move (moveNode)
import Gargantext.Components.Forest.Tree.Node.Action.Move (moveNode
Req
)
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 (ShareValue(..), share)
import Gargantext.Components.Forest.Tree.Node.Action.Update (updateRequest)
import Gargantext.Components.Forest.Tree.Node.Action.Update (updateRequest)
...
@@ -306,7 +306,7 @@ performAction DownloadNode _ = do
...
@@ -306,7 +306,7 @@ performAction DownloadNode _ = do
liftEffect $ log "[performAction] DownloadNode"
liftEffect $ log "[performAction] DownloadNode"
-------
-------
performAction (MoveNode n1 n2) p@{session} = do
performAction (MoveNode n1 n2) p@{session} = do
void
$ moveNode
session n1 n2
void
$ moveNodeReq
session n1 n2
performAction RefreshTree p
performAction RefreshTree p
-------
-------
performAction RefreshTree { reload: (_ /\ setReload) } = do
performAction RefreshTree { reload: (_ /\ setReload) } = do
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Move.purs
View file @
eae47cff
...
@@ -15,13 +15,15 @@ import Data.Generic.Rep.Show (genericShow)
...
@@ -15,13 +15,15 @@ import Data.Generic.Rep.Show (genericShow)
import Gargantext.Components.Forest.Tree.Node.Action (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action (Action(..))
import Reactix as R
import Reactix as R
import Gargantext.Components.Forest.Tree.Node.Tools (submitButton, panel)
import Gargantext.Components.Forest.Tree.Node.Tools (submitButton, panel)
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree (SubTreeParamsProps, subTreeView)
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
moveNode :: Session -> GT.ID -> GT.ID -> Aff (Array GT.ID)
-- TODO moveNodeReq
moveNode session fromId toId=
moveNodeReq :: Session -> GT.ID -> GT.ID -> Aff (Array GT.ID)
moveNodeReq session fromId toId =
put_ session $ NodeAPI GT.Node (Just fromId) ("move/" <> show toId)
put_ session $ NodeAPI GT.Node (Just fromId) ("move/" <> show toId)
moveNode :: Record SubTreeParamsProps -> R.Hooks R.Element
moveNode p = do
pure $ subTreeView p
src/Gargantext/Components/Forest/Tree/Node/Box.purs
View file @
eae47cff
...
@@ -21,10 +21,11 @@ import Gargantext.Components.Forest.Tree.Node.Action.Search.SearchField (default
...
@@ -21,10 +21,11 @@ import Gargantext.Components.Forest.Tree.Node.Action.Search.SearchField (default
import Gargantext.Components.Forest.Tree.Node.Action.Share as Share
import Gargantext.Components.Forest.Tree.Node.Action.Share as Share
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.Move (moveNode)
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.Tools (textInputBox, fragmentPT)
import Gargantext.Components.Forest.Tree.Node.Tools (textInputBox, fragmentPT)
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree (subTreeView)
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree (subTreeView
, SubTreeOut
)
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
import Gargantext.Types (Name, ID)
import Gargantext.Types (Name, ID)
import Gargantext.Types as GT
import Gargantext.Types as GT
...
@@ -247,13 +248,16 @@ panelActionCpt = R.hooksComponent "G.C.F.T.N.B.panelAction" cpt
...
@@ -247,13 +248,16 @@ panelActionCpt = R.hooksComponent "G.C.F.T.N.B.panelAction" cpt
-----------
-----------
cpt {action: Merge {subTreeParams}, dispatch, id, nodeType, session} _ = do
cpt {action: Merge {subTreeParams}, dispatch, id, nodeType, session} _ = do
pure $ subTreeView {dispatch, id, nodeType, session, subTreeParams}
subTreeOut :: R.State (Maybe SubTreeOut) <- R.useState' Nothing
pure $ subTreeView {dispatch, id, nodeType, session, subTreeParams, subTreeOut}
cpt {action: Move {subTreeParams}, dispatch, id, nodeType, session} _ = do
cpt {action: Move {subTreeParams}, dispatch, id, nodeType, session} _ = do
pure $ subTreeView {dispatch, id, nodeType, session, subTreeParams}
subTreeOut :: R.State (Maybe SubTreeOut) <- R.useState' Nothing
moveNode {dispatch, id, nodeType, session, subTreeParams, subTreeOut}
cpt {action: Link {subTreeParams}, dispatch, id, nodeType, session} _ = do
cpt {action: Link {subTreeParams}, dispatch, id, nodeType, session} _ = do
pure $ subTreeView {dispatch, id, nodeType, session, subTreeParams}
subTreeOut :: R.State (Maybe SubTreeOut) <- R.useState' Nothing
pure $ subTreeView {dispatch, id, nodeType, session, subTreeParams, subTreeOut}
-----------
-----------
cpt {action : Share, dispatch, id, name } _ = do
cpt {action : Share, dispatch, id, name } _ = do
...
...
src/Gargantext/Components/Forest/Tree/Node/Settings.purs
View file @
eae47cff
...
@@ -37,7 +37,7 @@ data SubTreeParams = SubTreeParams { showtypes :: Array NodeType
...
@@ -37,7 +37,7 @@ data SubTreeParams = SubTreeParams { showtypes :: Array NodeType
derive instance eqSubTreeParams :: Eq SubTreeParams
derive instance eqSubTreeParams :: Eq SubTreeParams
derive instance genericSubTreeParams :: Generic SubTreeParams _
derive instance genericSubTreeParams :: Generic SubTreeParams _
instance showSubTreeParams :: Show SubTreeParams where
instance showSubTreeParams
:: Show SubTreeParams where
show = genericShow
show = genericShow
------------------------------------------------------------------------
------------------------------------------------------------------------
...
...
src/Gargantext/Components/Forest/Tree/Node/Tools/SubTree.purs
View file @
eae47cff
...
@@ -19,9 +19,13 @@ import Reactix as R
...
@@ -19,9 +19,13 @@ import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
data SubTreeOut = SubTreeOut { in :: GT.ID
, out :: GT.ID
}
------------------------------------------------------------------------
------------------------------------------------------------------------
type SubTreeParamsProps =
type SubTreeParamsProps =
( subTreeParams :: SubTreeParams
( subTreeParams :: SubTreeParams
, subTreeOut :: R.State (Maybe SubTreeOut)
| Props
| Props
)
)
...
@@ -32,23 +36,25 @@ subTreeViewCpt :: R.Component SubTreeParamsProps
...
@@ -32,23 +36,25 @@ subTreeViewCpt :: R.Component SubTreeParamsProps
subTreeViewCpt = R.hooksComponent "G.C.F.T.N.A.U.subTreeView" cpt
subTreeViewCpt = R.hooksComponent "G.C.F.T.N.A.U.subTreeView" cpt
where
where
cpt params@{ dispatch
cpt params@{ dispatch
, id
, id
, nodeType
, nodeType
, session
, session
, subTreeParams
, subTreeParams
} _ =
, subTreeOut
} _ =
do
do
let SubTreeParams {showtypes} = subTreeParams
let SubTreeParams {showtypes} = subTreeParams
useLoader session (loadSubTree showtypes) $
useLoader session (loadSubTree showtypes) $
\tree ->
\tree ->
subTreeViewLoaded { dispatch
subTreeViewLoaded { dispatch
, id
, id
, nodeType
, nodeType
, session
, session
, tree
, tree
, subTreeParams
, subTreeParams
}
, subTreeOut
}
loadSubTree :: Array GT.NodeType -> Session -> Aff FTree
loadSubTree :: Array GT.NodeType -> Session -> Aff FTree
loadSubTree nodetypes session = getSubTree session treeId nodetypes
loadSubTree nodetypes session = getSubTree session treeId nodetypes
...
@@ -116,8 +122,8 @@ subTreeTreeViewCpt = R.hooksComponent "G.C.F.T.N.A.U.subTreeTreeViewCpt" cpt
...
@@ -116,8 +122,8 @@ subTreeTreeViewCpt = R.hooksComponent "G.C.F.T.N.A.U.subTreeTreeViewCpt" cpt
$ \_ -> case validNodeType of
$ \_ -> case validNodeType of
false -> launchAff $ dispatch NoAction
false -> launchAff $ dispatch NoAction
true -> do
true -> do
log2 "[subTreeTreeViewCpt] from"
sourceI
d
log2 "[subTreeTreeViewCpt] from"
i
d
log2 "[subTreeTreeViewCpt] to"
i
d
log2 "[subTreeTreeViewCpt] to"
sourceI
d
launchAff $ dispatch (MoveNode id sourceId)
launchAff $ dispatch (MoveNode id sourceId)
--------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------
...
...
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