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
a918d9b1
Commit
a918d9b1
authored
Jun 28, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[REFACT] types of subtree
parent
825ee1c8
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
54 additions
and
39 deletions
+54
-39
Action.purs
src/Gargantext/Components/Forest/Tree/Node/Action.purs
+18
-18
Link.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Link.purs
+2
-1
Merge.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Merge.purs
+2
-1
Move.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Move.purs
+4
-1
Settings.purs
src/Gargantext/Components/Forest/Tree/Node/Settings.purs
+1
-11
SubTree.purs
...Gargantext/Components/Forest/Tree/Node/Tools/SubTree.purs
+2
-7
Types.purs
...text/Components/Forest/Tree/Node/Tools/SubTree/Types.purs
+25
-0
No files found.
src/Gargantext/Components/Forest/Tree/Node/Action.purs
View file @
a918d9b1
...
@@ -5,19 +5,19 @@ import Effect.Aff (Aff)
...
@@ -5,19 +5,19 @@ import Effect.Aff (Aff)
import Gargantext.Prelude (class Show, Unit)
import Gargantext.Prelude (class Show, Unit)
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
import Gargantext.Types as GT
import Gargantext.Types as GT
import Gargantext.Components.Forest.Tree.Node.Settings (NodeAction(..), glyphiconNodeAction, SubTreeParams(..))
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree.Types (SubTreeOut, SubTreeParams(..))
import Gargantext.Components.Forest.Tree.Node.Settings (NodeAction(..), glyphiconNodeAction)
import Gargantext.Components.Forest.Tree.Node.Action.Upload.Types (FileType, UploadFileContents)
import Gargantext.Components.Forest.Tree.Node.Action.Upload.Types (FileType, UploadFileContents)
import Gargantext.Components.Forest.Tree.Node.Action.Update.Types (UpdateNodeParams)
import Gargantext.Components.Forest.Tree.Node.Action.Update.Types (UpdateNodeParams)
{-
type UpdateNodeProps =
type Props =
( id :: GT.ID
( dispatch :: Action -> Aff Unit
, dispatch :: Action -> Aff Unit
, id :: Int
, name :: GT.Name
, nodeType :: GT.NodeType
, nodeType :: NodeType
, session :: Session
, params :: UpdateNodeParams
)
)
-}
data Action = AddNode String GT.NodeType
data Action = AddNode String GT.NodeType
| DeleteNode
| DeleteNode
...
@@ -28,11 +28,17 @@ data Action = AddNode String GT.NodeType
...
@@ -28,11 +28,17 @@ data Action = AddNode String GT.NodeType
| UploadFile GT.NodeType FileType (Maybe String) UploadFileContents
| UploadFile GT.NodeType FileType (Maybe String) UploadFileContents
| DownloadNode
| DownloadNode
| RefreshTree
| RefreshTree
| MoveNode GT.NodeID GT.NodeID
| MergeNode GT.NodeID GT.NodeID
| MoveNode GT.ID GT.ID
| LinkNode GT.NodeID GT.NodeID
| MergeNode GT.ID GT.ID
| LinkNode GT.ID GT.ID
-- | MoveNode (Maybe SubTreeOut)
-- | MergeNode (Maybe SubTreeOut)
-- | LinkNode (Maybe SubTreeOut)
| NoAction
| NoAction
instance showShow :: Show Action where
instance showShow :: Show Action where
show (AddNode _ _ )= "AddNode"
show (AddNode _ _ )= "AddNode"
show DeleteNode = "DeleteNode"
show DeleteNode = "DeleteNode"
...
@@ -48,12 +54,6 @@ instance showShow :: Show Action where
...
@@ -48,12 +54,6 @@ instance showShow :: Show Action where
show (LinkNode _ _) = "LinkNode"
show (LinkNode _ _) = "LinkNode"
show NoAction = "NoAction"
show NoAction = "NoAction"
type Props =
( dispatch :: Action -> Aff Unit
, id :: Int
, nodeType :: GT.NodeType
, session :: Session
)
-----------------------------------------------------------------------
-----------------------------------------------------------------------
icon :: Action -> String
icon :: Action -> String
icon (AddNode _ _) = glyphiconNodeAction (Add [])
icon (AddNode _ _) = glyphiconNodeAction (Add [])
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Link.purs
View file @
a918d9b1
...
@@ -6,7 +6,8 @@ import Data.Tuple.Nested ((/\))
...
@@ -6,7 +6,8 @@ import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Gargantext.Components.Forest.Tree.Node.Action (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action (Action(..))
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 (SubTreeParamsIn, subTreeView, SubTreeOut(..))
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree (subTreeView, SubTreeParamsIn)
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree.Types (SubTreeOut(..))
import Gargantext.Prelude
import Gargantext.Prelude
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, put_)
import Gargantext.Sessions (Session, put_)
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Merge.purs
View file @
a918d9b1
...
@@ -6,7 +6,8 @@ import Data.Tuple.Nested ((/\))
...
@@ -6,7 +6,8 @@ import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Gargantext.Components.Forest.Tree.Node.Action (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action (Action(..))
import Gargantext.Components.Forest.Tree.Node.Tools (submitButton, panel, checkbox, checkboxes)
import Gargantext.Components.Forest.Tree.Node.Tools (submitButton, panel, checkbox, checkboxes)
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree (SubTreeParamsIn, subTreeView, SubTreeOut(..))
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree (subTreeView, SubTreeParamsIn)
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree.Types (SubTreeOut(..))
import Gargantext.Prelude
import Gargantext.Prelude
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, put_)
import Gargantext.Sessions (Session, put_)
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Move.purs
View file @
a918d9b1
...
@@ -6,7 +6,8 @@ import Data.Tuple.Nested ((/\))
...
@@ -6,7 +6,8 @@ import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Gargantext.Components.Forest.Tree.Node.Action (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action (Action(..))
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 (SubTreeParamsIn, subTreeView, SubTreeOut(..))
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree (subTreeView, SubTreeParamsIn)
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree.Types (SubTreeOut(..))
import Gargantext.Prelude
import Gargantext.Prelude
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, put_)
import Gargantext.Sessions (Session, put_)
...
@@ -22,11 +23,13 @@ moveNode :: Record SubTreeParamsIn -> R.Hooks R.Element
...
@@ -22,11 +23,13 @@ moveNode :: Record SubTreeParamsIn -> R.Hooks R.Element
moveNode p@{dispatch, subTreeParams, id, nodeType, session} = do
moveNode p@{dispatch, subTreeParams, id, nodeType, session} = do
subTreeOut@(subTreeOutParams /\ setSubTreeOut) :: R.State (Maybe SubTreeOut)
subTreeOut@(subTreeOutParams /\ setSubTreeOut) :: R.State (Maybe SubTreeOut)
<- R.useState' Nothing
<- R.useState' Nothing
let button = case subTreeOutParams of
let button = case subTreeOutParams of
Nothing -> H.div {} []
Nothing -> H.div {} []
Just sbto -> submitButton (MoveNode inId outId) dispatch
Just sbto -> submitButton (MoveNode inId outId) dispatch
where
where
(SubTreeOut { in:inId, out:outId}) = sbto
(SubTreeOut { in:inId, out:outId}) = sbto
pure $ panel [ subTreeView { subTreeOut
pure $ panel [ subTreeView { subTreeOut
, dispatch
, dispatch
, subTreeParams
, subTreeParams
...
...
src/Gargantext/Components/Forest/Tree/Node/Settings.purs
View file @
a918d9b1
...
@@ -4,6 +4,7 @@ import Data.Generic.Rep (class Generic)
...
@@ -4,6 +4,7 @@ import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Show (genericShow)
import Data.Generic.Rep.Show (genericShow)
import Data.Generic.Rep.Eq (genericEq)
import Data.Generic.Rep.Eq (genericEq)
import Gargantext.Prelude (class Eq, class Show, show, (&&), (<>), (==))
import Gargantext.Prelude (class Eq, class Show, show, (&&), (<>), (==))
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree.Types (SubTreeParams(..))
import Data.Array (foldl)
import Data.Array (foldl)
import Gargantext.Types
import Gargantext.Types
...
@@ -24,19 +25,8 @@ data NodeAction = Documentation NodeType
...
@@ -24,19 +25,8 @@ data NodeAction = Documentation NodeType
| Move { subTreeParams :: SubTreeParams }
| Move { subTreeParams :: SubTreeParams }
| Link { subTreeParams :: SubTreeParams }
| Link { subTreeParams :: SubTreeParams }
| Clone
| Clone
------------------------------------------------------------------------
-- 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)
eq SearchBox SearchBox = true
eq SearchBox SearchBox = true
...
...
src/Gargantext/Components/Forest/Tree/Node/Tools/SubTree.purs
View file @
a918d9b1
...
@@ -6,7 +6,7 @@ import Data.Tuple.Nested ((/\))
...
@@ -6,7 +6,7 @@ import Data.Tuple.Nested ((/\))
import Effect.Uncurried (mkEffectFn1)
import Effect.Uncurried (mkEffectFn1)
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.SubTree.Types (SubTreeParams(..), SubTreeOut
(..))
import Gargantext.Components.Forest.Tree.Node.Tools.FTree (FTree, LNode(..), NTree(..))
import Gargantext.Components.Forest.Tree.Node.Tools.FTree (FTree, LNode(..), NTree(..))
import Gargantext.Components.Forest.Tree.Node.Tools (nodeText)
import Gargantext.Components.Forest.Tree.Node.Tools (nodeText)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
...
@@ -17,16 +17,11 @@ import Gargantext.Types as GT
...
@@ -17,16 +17,11 @@ import Gargantext.Types as GT
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
type SubTreeParamsIn =
type SubTreeParamsIn =
( subTreeParams :: SubTreeParams
( subTreeParams :: SubTreeParams
| Props
| Props
)
)
------------------------------------------------------------------------
data SubTreeOut = SubTreeOut { in :: GT.ID
, out :: GT.ID
}
------------------------------------------------------------------------
------------------------------------------------------------------------
type SubTreeParamsProps =
type SubTreeParamsProps =
( subTreeOut :: R.State (Maybe SubTreeOut)
( subTreeOut :: R.State (Maybe SubTreeOut)
...
...
src/Gargantext/Components/Forest/Tree/Node/Tools/SubTree/Types.purs
0 → 100644
View file @
a918d9b1
module Gargantext.Components.Forest.Tree.Node.Tools.SubTree.Types where
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Eq (genericEq)
import Data.Generic.Rep.Show (genericShow)
import Gargantext.Prelude (class Eq, class Show)
import Gargantext.Types as GT
import Reactix as R
data SubTreeOut = SubTreeOut { in :: GT.ID
, out :: GT.ID
}
------------------------------------------------------------------------
data SubTreeParams = SubTreeParams { showtypes :: Array GT.NodeType
, valitypes :: Array GT.NodeType
}
derive instance eqSubTreeParams :: Eq SubTreeParams
derive instance genericSubTreeParams :: Generic SubTreeParams _
instance showSubTreeParams :: Show SubTreeParams where
show = genericShow
------------------------------------------------------------------------
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