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
69f83025
Commit
69f83025
authored
Jun 22, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[REFACT] organize funs (WIP)
parent
1c082d54
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
34 deletions
+43
-34
Tree.purs
src/Gargantext/Components/Forest/Tree.purs
+11
-3
Action.purs
src/Gargantext/Components/Forest/Tree/Node/Action.purs
+0
-2
CopyFrom.purs
...rgantext/Components/Forest/Tree/Node/Action/CopyFrom.purs
+15
-17
Box.purs
src/Gargantext/Components/Forest/Tree/Node/Box.purs
+2
-0
Settings.purs
src/Gargantext/Components/Forest/Tree/Node/Settings.purs
+15
-12
No files found.
src/Gargantext/Components/Forest/Tree.purs
View file @
69f83025
...
@@ -2,7 +2,7 @@ module Gargantext.Components.Forest.Tree where
...
@@ -2,7 +2,7 @@ module Gargantext.Components.Forest.Tree where
import DOM.Simple.Console (log, log2)
import DOM.Simple.Console (log, log2)
import Data.Array as A
import Data.Array as A
import Data.Maybe (Maybe)
import Data.Maybe (Maybe
(..)
)
import Data.Set as Set
import Data.Set as Set
import Data.Tuple (Tuple(..), fst, snd)
import Data.Tuple (Tuple(..), fst, snd)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
...
@@ -12,7 +12,6 @@ import Gargantext.AsyncTasks as GAT
...
@@ -12,7 +12,6 @@ import Gargantext.AsyncTasks as GAT
import Gargantext.Components.Forest.Tree.Node (nodeMainSpan)
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.CopyFrom (getNodeTree)
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.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)
...
@@ -24,8 +23,10 @@ import Gargantext.Ends (Frontends)
...
@@ -24,8 +23,10 @@ import Gargantext.Ends (Frontends)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude (Unit, bind, discard, map, pure, void, ($), (+), (<>))
import Gargantext.Prelude (Unit, bind, discard, map, pure, void, ($), (+), (<>))
import Gargantext.Routes (AppRoute)
import Gargantext.Routes (AppRoute)
import Gargantext.Sessions (OpenNodes, Session, mkNodeId)
import Gargantext.Sessions (OpenNodes, Session, mkNodeId
, get
)
import Gargantext.Types (ID, Reload)
import Gargantext.Types (ID, Reload)
import Gargantext.Types as GT
import Gargantext.Routes as GR
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import Record as Record
import Record as Record
...
@@ -95,6 +96,13 @@ treeLoadView p = R.createElement treeLoadViewCpt p []
...
@@ -95,6 +96,13 @@ treeLoadView p = R.createElement treeLoadViewCpt p []
}
}
useLoader { root, counter: fst reload } fetch paint
useLoader { root, counter: fst reload } fetch paint
--------------
getNodeTree :: Session -> GT.ID -> Aff FTree
getNodeTree session nodeId = get session $ GR.NodeAPI GT.Tree (Just nodeId) ""
--------------
type TreeViewProps = ( asyncTasks :: R.State GAT.Storage
type TreeViewProps = ( asyncTasks :: R.State GAT.Storage
, tree :: FTree
, tree :: FTree
, tasks :: Record Tasks
, tasks :: Record Tasks
...
...
src/Gargantext/Components/Forest/Tree/Node/Action.purs
View file @
69f83025
...
@@ -19,7 +19,6 @@ type UpdateNodeProps =
...
@@ -19,7 +19,6 @@ type UpdateNodeProps =
)
)
-}
-}
data Action = AddNode String GT.NodeType
data Action = AddNode String GT.NodeType
| DeleteNode
| DeleteNode
| RenameNode String
| RenameNode String
...
@@ -30,7 +29,6 @@ data Action = AddNode String GT.NodeType
...
@@ -30,7 +29,6 @@ data Action = AddNode String GT.NodeType
| DownloadNode
| DownloadNode
| RefreshTree
| RefreshTree
instance showShow :: Show Action where
instance showShow :: Show Action where
show (AddNode _ _ )= "AddNode"
show (AddNode _ _ )= "AddNode"
show DeleteNode = "DeleteNode"
show DeleteNode = "DeleteNode"
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/CopyFrom.purs
View file @
69f83025
...
@@ -19,17 +19,11 @@ import Reactix.DOM.HTML as H
...
@@ -19,17 +19,11 @@ import Reactix.DOM.HTML as H
------------------------------------------------------------------------
------------------------------------------------------------------------
getNodeTree :: Session -> GT.ID -> Aff FTree
getNodeTree session nodeId = get session $ GR.NodeAPI GT.Tree (Just nodeId) ""
------------------------------------------------------------------------
type SubTreeParamsProps =
type SubTreeParamsProps =
( subTreeParams :: SubTreeParams
( subTreeParams :: SubTreeParams
| Props
| Props
)
)
copyFromCorpusView :: Record SubTreeParamsProps -> R.Element
copyFromCorpusView :: Record SubTreeParamsProps -> R.Element
copyFromCorpusView props = R.createElement copyFromCorpusViewCpt props []
copyFromCorpusView props = R.createElement copyFromCorpusViewCpt props []
...
@@ -55,8 +49,17 @@ copyFromCorpusViewCpt = R.hooksComponent "G.C.F.T.N.A.U.copyFromCorpusView" cpt
...
@@ -55,8 +49,17 @@ copyFromCorpusViewCpt = R.hooksComponent "G.C.F.T.N.A.U.copyFromCorpusView" cpt
, subTreeParams
, subTreeParams
}
}
------------------------------------------------------------------------
loadSubTree :: Array GT.NodeType -> Session -> Aff FTree
loadSubTree nodetypes session = getSubTree session treeId nodetypes
where
Session { treeId } = session
getSubTree :: Session -> Int -> Array GT.NodeType -> Aff FTree
getSubTree session treeId showtypes = get session $ GR.NodeAPI GT.Tree (Just treeId) nodeTypes
where
nodeTypes = A.foldl (\a b -> a <> "type=" <> show b <> "&") "?" showtypes
------------------------------------------------------------------------
type CorpusTreeProps =
type CorpusTreeProps =
( tree :: FTree
( tree :: FTree
| SubTreeParamsProps
| SubTreeParamsProps
...
@@ -91,10 +94,15 @@ copyFromCorpusTreeViewCpt = R.hooksComponent "G.C.F.T.N.A.U.copyFromCorpusTreeVi
...
@@ -91,10 +94,15 @@ copyFromCorpusTreeViewCpt = R.hooksComponent "G.C.F.T.N.A.U.copyFromCorpusTreeVi
)
)
-- ]
-- ]
where
where
SubTreeParams { valitypes } = subTreeParams
SubTreeParams { valitypes } = subTreeParams
children = map (\c -> copyFromCorpusTreeView (p { tree = c })) ary
children = map (\c -> copyFromCorpusTreeView (p { tree = c })) ary
validNodeType = (A.elem nodeType valitypes) && (id /= sourceId)
validNodeType = (A.elem nodeType valitypes) && (id /= sourceId)
clickable = if validNodeType then "clickable" else ""
clickable = if validNodeType then "clickable" else ""
onClick _ = case validNodeType of
onClick _ = case validNodeType of
false -> pure unit
false -> pure unit
true -> do
true -> do
...
@@ -102,14 +110,4 @@ copyFromCorpusTreeViewCpt = R.hooksComponent "G.C.F.T.N.A.U.copyFromCorpusTreeVi
...
@@ -102,14 +110,4 @@ copyFromCorpusTreeViewCpt = R.hooksComponent "G.C.F.T.N.A.U.copyFromCorpusTreeVi
log2 "[copyFromCorpusTreeViewCpt] issue copy from" sourceId
log2 "[copyFromCorpusTreeViewCpt] issue copy from" sourceId
--------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------
loadSubTree :: Array GT.NodeType -> Session -> Aff FTree
loadSubTree nodetypes session = getSubTree session treeId nodetypes
where
Session { treeId } = session
getSubTree :: Session -> Int -> Array GT.NodeType -> Aff FTree
getSubTree session treeId showtypes = get session $ GR.NodeAPI GT.Tree (Just treeId) nodeTypes
where
nodeTypes = A.foldl (\a b -> a <> "type=" <> show b <> "&") "?" showtypes
src/Gargantext/Components/Forest/Tree/Node/Box.purs
View file @
69f83025
...
@@ -238,6 +238,7 @@ panelActionCpt = R.hooksComponent "G.C.F.T.N.B.panelAction" cpt
...
@@ -238,6 +238,7 @@ panelActionCpt = R.hooksComponent "G.C.F.T.N.B.panelAction" cpt
cpt {action: Config , dispatch, id, nodeType, session} _ = do
cpt {action: Config , dispatch, id, nodeType, session} _ = do
pure $ fragmentPT $ "Config " <> show nodeType
pure $ fragmentPT $ "Config " <> show nodeType
-----------
cpt {action: Merge {subTreeParams}, dispatch, id, nodeType, session} _ = do
cpt {action: Merge {subTreeParams}, dispatch, id, nodeType, session} _ = do
pure $ copyFromCorpusView {dispatch, id, nodeType, session, subTreeParams}
pure $ copyFromCorpusView {dispatch, id, nodeType, session, subTreeParams}
...
@@ -246,6 +247,7 @@ panelActionCpt = R.hooksComponent "G.C.F.T.N.B.panelAction" cpt
...
@@ -246,6 +247,7 @@ panelActionCpt = R.hooksComponent "G.C.F.T.N.B.panelAction" cpt
cpt {action: Link {subTreeParams}, dispatch, id, nodeType, session} _ = do
cpt {action: Link {subTreeParams}, dispatch, id, nodeType, session} _ = do
pure $ copyFromCorpusView {dispatch, id, nodeType, session, subTreeParams}
pure $ copyFromCorpusView {dispatch, id, nodeType, session, subTreeParams}
-----------
cpt {action : Share, dispatch, id, name } _ = do
cpt {action : Share, dispatch, id, name } _ = do
isOpen <- R.useState' true
isOpen <- R.useState' true
...
...
src/Gargantext/Components/Forest/Tree/Node/Settings.purs
View file @
69f83025
...
@@ -15,7 +15,8 @@ if user has access to node then he can do all his related actions
...
@@ -15,7 +15,8 @@ if user has access to node then he can do all his related actions
-}
-}
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
data Status a = IsBeta a | IsProd a
-- Beta Status
data Status a = TODO a | WIP a | OnTest a | Beta a
data NodeAction = Documentation NodeType
data NodeAction = Documentation NodeType
| SearchBox
| SearchBox
...
@@ -250,6 +251,8 @@ settingsBox _ =
...
@@ -250,6 +251,8 @@ settingsBox _ =
, buttons : []
, buttons : []
}
}
-- | SubTree Parameters
moveParameters = { subTreeParams : SubTreeParams
moveParameters = { subTreeParams : SubTreeParams
{ showtypes: [ FolderPrivate
{ showtypes: [ FolderPrivate
, FolderShared
, FolderShared
...
@@ -267,15 +270,15 @@ moveParameters = { subTreeParams : SubTreeParams
...
@@ -267,15 +270,15 @@ moveParameters = { subTreeParams : SubTreeParams
}
}
linkParams = { subTreeParams : SubTreeParams
linkParams = { subTreeParams : SubTreeParams
{ showtypes: [ FolderPrivate
{ showtypes: [ FolderPrivate
, FolderShared
, FolderShared
, Team
, Team
, FolderPublic
, FolderPublic
, Folder
, Folder
, Annuaire
, Annuaire
]
]
, valitypes: [ Annuaire
, valitypes: [ Annuaire
]
]
}
}
}
}
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