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
c1227c93
Commit
c1227c93
authored
Oct 23, 2020
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[tree] add support for team highlight in tree
parent
543b31c8
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
95 additions
and
89 deletions
+95
-89
Tree.purs
src/Gargantext/Components/Forest/Tree.purs
+57
-55
Node.purs
src/Gargantext/Components/Forest/Tree/Node.purs
+2
-5
Corpus.purs
src/Gargantext/Components/Nodes/Corpus.purs
+1
-0
Routes.purs
src/Gargantext/Routes.purs
+21
-18
Types.purs
src/Gargantext/Types.purs
+14
-11
No files found.
src/Gargantext/Components/Forest/Tree.purs
View file @
c1227c93
...
...
@@ -166,63 +166,65 @@ type ToHtmlProps =
)
toHtml :: Record ToHtmlProps -> R.Element
toHtml p@{ asyncTasks
, frontends
, mCurrentRoute
, openNodes
, reload: reload@(_ /\ setReload)
, session
, tasks: tasks@{ onTaskAdd
, onTaskFinish
, tasks: tasks'
}
, tree: tree@(NTree (LNode { id
, name
, nodeType
}
toHtml p = R.createElement toHtmlCpt p []
toHtmlCpt :: R.Component ToHtmlProps
toHtmlCpt = R.hooksComponentWithModule thisModule "toHtml" cpt
where
cpt p@{ asyncTasks
, frontends
, mCurrentRoute
, openNodes
, reload: reload@(_ /\ setReload)
, session
, tasks: tasks@{ onTaskAdd
, onTaskFinish
, tasks: tasks'
}
, tree: tree@(NTree (LNode { id
, name
, nodeType
}
) ary
)
, handed
} _ = do
let nodeId = mkNodeId session id
let folderIsOpen = Set.member nodeId (fst openNodes)
let setFn = if folderIsOpen then Set.delete else Set.insert
let toggleFolderIsOpen _ = (snd openNodes) (setFn nodeId)
let folderOpen = Tuple folderIsOpen toggleFolderIsOpen
let withId (NTree (LNode {id: id'}) _) = id'
pure $ H.li { className: if A.null ary then "no-children" else "with-children" } $
[ nodeMainSpan (A.null ary)
{ id
, dispatch: pAction
, folderOpen
, frontends
, handed
, mCurrentRoute
, name
, nodeType
, session
, tasks
} ]
<> childNodes ( Record.merge commonProps
{ asyncTasks
, children: if isPublic nodeType
then map (\t -> map (\(LNode n@{ nodeType:nt } )
-> (LNode (n { nodeType= publicize nt }))
) t) ary
else ary
, folderOpen
, handed
}
)
, handed
} =
R.createElement el {} []
where
el = R.hooksComponentWithModule thisModule "nodeView" cpt
commonProps = RecordE.pick p :: Record CommonProps
pAction a = performAction a (RecordE.pick p :: Record PerformActionProps)
cpt _ _ = do
let nodeId = mkNodeId session id
let folderIsOpen = Set.member nodeId (fst openNodes)
let setFn = if folderIsOpen then Set.delete else Set.insert
let toggleFolderIsOpen _ = (snd openNodes) (setFn nodeId)
let folderOpen = Tuple folderIsOpen toggleFolderIsOpen
let withId (NTree (LNode {id: id'}) _) = id'
pure $ H.li { className: if A.null ary then "no-children" else "with-children" } $
[ nodeMainSpan (A.null ary)
{ id
, dispatch: pAction
, folderOpen
, frontends
, handed
, mCurrentRoute
, name
, nodeType
, session
, tasks
} ]
<> childNodes ( Record.merge commonProps
{ asyncTasks
, children: if isPublic nodeType
then map (\t -> map (\(LNode n@{ nodeType:nt } )
-> (LNode (n { nodeType= publicize nt }))
) t) ary
else ary
, folderOpen
, handed
}
)
where
commonProps = RecordE.pick p :: Record CommonProps
pAction a = performAction a (RecordE.pick p :: Record PerformActionProps)
type ChildNodesProps =
...
...
src/Gargantext/Components/Forest/Tree/Node.purs
View file @
c1227c93
...
...
@@ -57,7 +57,7 @@ nodeMainSpan :: IsLeaf
nodeMainSpan isLeaf p@{ dispatch, folderOpen, frontends, handed, session } = R.createElement el p []
where
el = R.hooksComponentWithModule thisModule "nodeMainSpan" cpt
cpt props@{
id, mCurrentRoute, name, nodeType, tasks: { onTaskFinish, tasks }
} _ = do
cpt props@{
id, mCurrentRoute, name, nodeType, tasks: { onTaskFinish, tasks }
} _ = do
-- only 1 popup at a time is allowed to be opened
droppedFile <- R.useState' (Nothing :: Maybe DroppedFile)
isDragOver <- R.useState' false
...
...
@@ -76,10 +76,7 @@ nodeMainSpan isLeaf p@{ dispatch, folderOpen, frontends, handed, session } = R.c
, nodeLink { frontends
, id
, folderOpen
, isSelected: mCurrentRoute
== Routes.nodeTypeAppRoute
nodeType
(sessionId session) id
, isSelected: mCurrentRoute == Routes.nodeTypeAppRoute nodeType (sessionId session) id
, name: name' props
, nodeType
, session
...
...
src/Gargantext/Components/Nodes/Corpus.purs
View file @
c1227c93
...
...
@@ -30,6 +30,7 @@ import Gargantext.Types (NodeType(..), AffTableResult)
import Gargantext.Utils.Crypto as Crypto
import Gargantext.Utils.Reactix as R2
thisModule :: String
thisModule = "Gargantext.Components.Nodes.Corpus"
type Props =
...
...
src/Gargantext/Routes.purs
View file @
c1227c93
...
...
@@ -10,26 +10,26 @@ import Gargantext.Types (ChartOpts, ChartType, CorpusMetricOpts, CTabNgramType,
import Gargantext.Types as GT
data AppRoute
= Home
| Login
= Annuaire SessionId Int
| ContactPage SessionId Int Int
| Corpus SessionId Int
| CorpusDocument SessionId Int Int Int
| Dashboard SessionId Int
| Document SessionId Int Int
| Folder SessionId Int
| FolderPrivate SessionId Int
| FolderPublic SessionId Int
| FolderShared SessionId Int
| Team SessionId Int
| Corpus SessionId Int
| Document SessionId Int Int
| CorpusDocument SessionId Int Int Int
| PGraphExplorer SessionId Int
| Dashboard SessionId Int
| Texts SessionId Int
| Lists SessionId Int
| Annuaire SessionId Int
| UserPage SessionId Int
| ContactPage SessionId Int Int
| RouteFrameWrite SessionId Int
| RouteFrameCalc SessionId Int
| Home
| Lists SessionId Int
| Login
| PGraphExplorer SessionId Int
| RouteFile SessionId Int
| RouteFrameCalc SessionId Int
| RouteFrameWrite SessionId Int
| Team SessionId Int
| Texts SessionId Int
| UserPage SessionId Int
derive instance eqAppRoute :: Eq AppRoute
...
...
@@ -104,14 +104,17 @@ appPath (RouteFile s i) = "file/" <> show s <> "/" <> show i
nodeTypeAppRoute :: NodeType -> SessionId -> Int -> Maybe AppRoute
nodeTypeAppRoute GT.Annuaire s i = Just $ Annuaire s i
nodeTypeAppRoute GT.NodeContact s i = Just $ Annuaire s i
nodeTypeAppRoute GT.Corpus s i = Just $ Corpus s i
nodeTypeAppRoute GT.Dashboard s i = Just $ Dashboard s i
nodeTypeAppRoute GT.Graph s i = Just $ PGraphExplorer s i
nodeTypeAppRoute GT.NodeList s i = Just $ Lists s i
nodeTypeAppRoute GT.Folder s i = Just $ Folder s i
nodeTypeAppRoute GT.FolderPrivate s i = Just $ FolderPrivate s i
nodeTypeAppRoute GT.FolderPublic s i = Just $ FolderPublic s i
nodeTypeAppRoute GT.FolderShared s i = Just $ FolderShared s i
nodeTypeAppRoute GT.Graph s i = Just $ PGraphExplorer s i
nodeTypeAppRoute GT.NodeContact s i = Just $ Annuaire s i
nodeTypeAppRoute GT.NodeFile s i = Just $ RouteFile s i
nodeTypeAppRoute GT.NodeList s i = Just $ Lists s i
nodeTypeAppRoute GT.NodeUser s i = Just $ UserPage s i
nodeTypeAppRoute GT.Team s i = Just $ Team s i
nodeTypeAppRoute GT.Texts s i = Just $ Texts s i
nodeTypeAppRoute _ _ _ = Nothing
src/Gargantext/Types.purs
View file @
c1227c93
...
...
@@ -136,28 +136,31 @@ instance encodeJsonTabPostQuery :: EncodeJson TabPostQuery where
~> "query" := post.query
~> jsonEmptyObject
data NodeType = NodeUser
| Folder | FolderPrivate | FolderShared | FolderPublic
| Annuaire
| NodeContact
data NodeType = Annuaire
| Corpus
| Team
| Url_Document
| Dashboard
| Error
| Folder
| FolderPrivate
| FolderPublic
| FolderShared
| Graph
| Phylo
| Individu
| Node
| Nodes
| Tree
| NodeContact
| NodeList
| NodeUser
| Nodes
| Phylo
| Team
| Texts
| Tree
| Url_Document
-- TODO Optional Nodes
| NodeF
rameWrit
e
| NodeF
il
e
| NodeFrameCalc
| NodeFrameWrite
| NodePublic NodeType
| NodeFile
derive instance eqNodeType :: Eq NodeType
...
...
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