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
6b229104
Commit
6b229104
authored
Jun 21, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[REFACT] subtree (WIP)
parent
1f854b04
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
33 deletions
+70
-33
CopyFrom.purs
...rgantext/Components/Forest/Tree/Node/Action/CopyFrom.purs
+27
-18
Box.purs
src/Gargantext/Components/Forest/Tree/Node/Box.purs
+3
-3
Settings.purs
src/Gargantext/Components/Forest/Tree/Node/Settings.purs
+40
-12
No files found.
src/Gargantext/Components/Forest/Tree/Node/Action/CopyFrom.purs
View file @
6b229104
...
@@ -3,11 +3,14 @@ module Gargantext.Components.Forest.Tree.Node.Action.CopyFrom where
...
@@ -3,11 +3,14 @@ module Gargantext.Components.Forest.Tree.Node.Action.CopyFrom where
import DOM.Simple.Console (log2)
import DOM.Simple.Console (log2)
import Data.Array as A
import Data.Array as A
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Eq (genericEq)
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Gargantext.Components.Forest.Tree.Node.Action (Props)
import Gargantext.Components.Forest.Tree.Node.Action (Props)
import Gargantext.Components.Forest.Tree.Node.Settings (SubTreeParams(..))
import Gargantext.Components.Forest.Tree.Node.Tools.FTree (FTree, LNode(..), NTree(..))
import Gargantext.Components.Forest.Tree.Node.Tools.FTree (FTree, LNode(..), NTree(..))
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude (discard, map, pure, show, unit, ($), (&&), (/=), (<>))
import Gargantext.Prelude (discard, map, pure, show, unit, ($), (&&), (/=), (<>)
, class Eq
)
import Gargantext.Routes as GR
import Gargantext.Routes as GR
import Gargantext.Sessions (Session(..), get)
import Gargantext.Sessions (Session(..), get)
import Gargantext.Types as GT
import Gargantext.Types as GT
...
@@ -19,19 +22,30 @@ import Reactix.DOM.HTML as H
...
@@ -19,19 +22,30 @@ import Reactix.DOM.HTML as H
getNodeTree :: Session -> GT.ID -> Aff FTree
getNodeTree :: Session -> GT.ID -> Aff FTree
getNodeTree session nodeId = get session $ GR.NodeAPI GT.Tree (Just nodeId) ""
getNodeTree session nodeId = get session $ GR.NodeAPI GT.Tree (Just nodeId) ""
copyFromCorpusView :: Record Props -> R.Element
------------------------------------------------------------------------
type SubTreeParamsProps =
( subTreeParams :: SubTreeParams
| Props
)
copyFromCorpusView :: Record SubTreeParamsProps -> R.Element
copyFromCorpusView props = R.createElement copyFromCorpusViewCpt props []
copyFromCorpusView props = R.createElement copyFromCorpusViewCpt props []
copyFromCorpusViewCpt :: R.Component Props
copyFromCorpusViewCpt :: R.Component
SubTreeParams
Props
copyFromCorpusViewCpt = R.hooksComponent "G.C.F.T.N.A.U.copyFromCorpusView" cpt
copyFromCorpusViewCpt = R.hooksComponent "G.C.F.T.N.A.U.copyFromCorpusView" cpt
where
where
cpt { dispatch
cpt
params@
{ dispatch
, id
, id
, nodeType
, nodeType
, session
, session
, subTreeParams
} _ =
} _ =
do
do
useLoader session loadCorporaTree $
let SubTreeParams {showtypes} = subTreeParams
useLoader session (loadSubTree showtypes) $
\tree ->
\tree ->
copyFromCorpusViewLoaded { dispatch
copyFromCorpusViewLoaded { dispatch
, id
, id
...
@@ -85,20 +99,15 @@ copyFromCorpusTreeViewCpt = R.hooksComponent "G.C.F.T.N.A.U.copyFromCorpusTreeVi
...
@@ -85,20 +99,15 @@ copyFromCorpusTreeViewCpt = R.hooksComponent "G.C.F.T.N.A.U.copyFromCorpusTreeVi
log2 "[copyFromCorpusTreeViewCpt] issue copy into" id
log2 "[copyFromCorpusTreeViewCpt] issue copy into" id
log2 "[copyFromCorpusTreeViewCpt] issue copy from" sourceId
log2 "[copyFromCorpusTreeViewCpt] issue copy from" sourceId
loadCorporaTree :: Session -> Aff FTree
--------------------------------------------------------------------------------------------
loadCorporaTree session = getCorporaTree session treeId
loadSubTree :: Array GT.NodeType -> Session -> Aff FTree
loadSubTree nodetypes session = getSubTree session treeId nodetypes
where
where
Session { treeId } = session
Session { treeId } = session
get
CorporaTree :: Session -> Int
-> Aff FTree
get
SubTree :: Session -> Int -> Array GT.NodeType
-> Aff FTree
get
CorporaTree session treeId
= get session $ GR.NodeAPI GT.Tree (Just treeId) nodeTypes
get
SubTree session treeId showtypes
= get session $ GR.NodeAPI GT.Tree (Just treeId) nodeTypes
where
where
nodeTypes = A.foldl (\a b -> a <> "type=" <> show b <> "&") "?" typesList
nodeTypes = A.foldl (\a b -> a <> "type=" <> show b <> "&") "?" showtypes
typesList = [ GT.FolderPrivate
, GT.FolderShared
, GT.Team
, GT.FolderPublic
, GT.Folder
, GT.Corpus
, GT.NodeList
]
src/Gargantext/Components/Forest/Tree/Node/Box.purs
View file @
6b229104
...
@@ -19,7 +19,7 @@ import Gargantext.Components.Forest.Tree.Node.Action.Share as Share
...
@@ -19,7 +19,7 @@ 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.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
, SubTreeParams(..)
)
import Gargantext.Components.Forest.Tree.Node.Tools (textInputBox, fragmentPT)
import Gargantext.Components.Forest.Tree.Node.Tools (textInputBox, fragmentPT)
import Gargantext.Prelude (Unit, bind, const, map, pure, show, ($), (<>), (==), (<))
import Gargantext.Prelude (Unit, bind, const, map, pure, show, ($), (<>), (==), (<))
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
...
@@ -238,8 +238,8 @@ panelActionCpt = R.hooksComponent "G.C.F.T.N.B.panelAction" cpt
...
@@ -238,8 +238,8 @@ 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:
CopyFromCorpus
, dispatch, id, nodeType, session} _ = do
cpt {action:
Merge {subTreeParams}
, dispatch, id, nodeType, session} _ = do
pure $ copyFromCorpusView {dispatch, id, nodeType, session}
pure $ copyFromCorpusView {dispatch, id, nodeType, session
, subTreeParams
}
cpt {action: Link _} _ = pure $ fragmentPT $ "Soon, you will be able "
cpt {action: Link _} _ = pure $ fragmentPT $ "Soon, you will be able "
<> "to link the corpus with your Annuaire"
<> "to link the corpus with your Annuaire"
...
...
src/Gargantext/Components/Forest/Tree/Node/Settings.purs
View file @
6b229104
module Gargantext.Components.Forest.Tree.Node.Settings where
module Gargantext.Components.Forest.Tree.Node.Settings where
import Prelude (class Eq, class Show, show, (&&), (<>), (==))
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Show (genericShow)
import Data.Generic.Rep.Eq (genericEq)
import Gargantext.Prelude (class Eq, class Show, show, (&&), (<>), (==))
import Data.Array (foldl)
import Data.Array (foldl)
import Gargantext.Types
import Gargantext.Types
...
@@ -17,11 +20,26 @@ data Status a = IsBeta a | IsProd a
...
@@ -17,11 +20,26 @@ data Status a = IsBeta a | IsProd a
data NodeAction = Documentation NodeType
data NodeAction = Documentation NodeType
| SearchBox
| SearchBox
| Download | Upload | Refresh | Config
| Download | Upload | Refresh | Config
| Move | Clone | Delete
| Delete
| Share | Link NodeType
| Share
| Add (Array NodeType)
| Add (Array NodeType)
| CopyFromCorpus
| Merge { subTreeParams :: SubTreeParams }
| Move
| Clone
| Link NodeType
------------------------------------------------------------------------
-- TODO move elsewhere
data SubTreeParams = SubTreeParams { showtypes :: Array NodeType
, valitypes :: Array NodeType
}
derive instance eqSubTreeParams :: Eq SubTreeParams
derive instance genericSubTreeParams :: Generic SubTreeParams _
instance showSubTreeParams :: Show SubTreeParams where
show = genericShow
------------------------------------------------------------------------
instance eqNodeAction :: Eq NodeAction where
instance eqNodeAction :: Eq NodeAction where
eq (Documentation x) (Documentation y) = true && (x == y)
eq (Documentation x) (Documentation y) = true && (x == y)
...
@@ -33,9 +51,9 @@ instance eqNodeAction :: Eq NodeAction where
...
@@ -33,9 +51,9 @@ instance eqNodeAction :: Eq NodeAction where
eq Clone Clone = true
eq Clone Clone = true
eq Delete Delete = true
eq Delete Delete = true
eq Share Share = true
eq Share Share = true
eq (Link x) (Link y)
= (x == y)
eq (Link x) (Link y)
= x == y
eq (Add x) (Add y)
= (x == y)
eq (Add x) (Add y)
= x == y
eq
CopyFromCorpus CopyFromCorpus = true
eq
(Merge x) (Merge y) = x == y
eq Config Config = true
eq Config Config = true
eq _ _ = false
eq _ _ = false
...
@@ -52,7 +70,7 @@ instance showNodeAction :: Show NodeAction where
...
@@ -52,7 +70,7 @@ instance showNodeAction :: Show NodeAction where
show Config = "Config"
show Config = "Config"
show (Link x) = "Link to " <> show x
show (Link x) = "Link to " <> show x
show (Add xs) = foldl (\a b -> a <> show b) "Add " xs
show (Add xs) = foldl (\a b -> a <> show b) "Add " xs
show
CopyFromCorpus = "Copy from corpus"
show
(Merge t) = "Merge with subtree" <> show t
glyphiconNodeAction :: NodeAction -> String
glyphiconNodeAction :: NodeAction -> String
...
@@ -63,7 +81,7 @@ glyphiconNodeAction SearchBox = "search"
...
@@ -63,7 +81,7 @@ glyphiconNodeAction SearchBox = "search"
glyphiconNodeAction Upload = "upload"
glyphiconNodeAction Upload = "upload"
glyphiconNodeAction (Link _) = "arrows-h"
glyphiconNodeAction (Link _) = "arrows-h"
glyphiconNodeAction Download = "download"
glyphiconNodeAction Download = "download"
glyphiconNodeAction
CopyFromCorpus
= "random"
glyphiconNodeAction
(Merge _)
= "random"
glyphiconNodeAction Refresh = "refresh"
glyphiconNodeAction Refresh = "refresh"
glyphiconNodeAction Config = "wrench"
glyphiconNodeAction Config = "wrench"
glyphiconNodeAction Share = "user-plus"
glyphiconNodeAction Share = "user-plus"
...
@@ -191,7 +209,17 @@ settingsBox NodeList =
...
@@ -191,7 +209,17 @@ settingsBox NodeList =
, Config
, Config
, Download
, Download
, Upload
, Upload
, CopyFromCorpus
, Merge {subTreeParams : SubTreeParams { showtypes: [ FolderPrivate
, FolderShared
, Team
, FolderPublic
, Folder
, Corpus
, NodeList
]
, valitypes: [ NodeList ]
}
}
, Delete
, Delete
]
]
}
}
...
@@ -207,7 +235,7 @@ settingsBox Dashboard =
...
@@ -207,7 +235,7 @@ settingsBox Dashboard =
settingsBox Annuaire =
settingsBox Annuaire =
SettingsBox { show : true
SettingsBox { show : true
, edit :
fals
e
, edit :
tru
e
, doc : Documentation Annuaire
, doc : Documentation Annuaire
, buttons : [ Upload
, buttons : [ Upload
, Move
, Move
...
...
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