Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
141
Issues
141
List
Board
Labels
Milestones
Merge Requests
5
Merge Requests
5
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
gargantext
haskell-gargantext
Commits
79e4ca7a
Commit
79e4ca7a
authored
Jun 05, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[REFACT] tree
parent
569f45ee
Pipeline
#876
failed with stage
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
10 deletions
+21
-10
Node.hs
src/Gargantext/API/Node.hs
+2
-2
Share.hs
src/Gargantext/Database/Action/Share.hs
+0
-2
Tree.hs
src/Gargantext/Database/Query/Tree.hs
+19
-6
No files found.
src/Gargantext/API/Node.hs
View file @
79e4ca7a
...
...
@@ -52,7 +52,7 @@ import Gargantext.Database.Query.Table.Node
import
Gargantext.Database.Query.Table.Node.Children
(
getChildren
)
import
Gargantext.Database.Query.Table.Node.UpdateOpaleye
(
updateHyperdata
)
import
Gargantext.Database.Query.Table.Node.User
import
Gargantext.Database.Query.Tree
(
tree
DB
)
import
Gargantext.Database.Query.Tree
(
tree
,
TreeMode
(
..
)
)
import
Gargantext.Database.Admin.Config
(
nodeTypeId
)
import
Gargantext.Database.Query.Table.Node.Error
(
HasNodeError
(
..
))
import
Gargantext.Database.Admin.Types.Node
...
...
@@ -310,7 +310,7 @@ type TreeApi = Summary " Tree API"
type
TreeAPI
=
QueryParams
"type"
NodeType
:>
Get
'[
J
SON
]
(
Tree
NodeTree
)
treeAPI
::
NodeId
->
GargServer
TreeAPI
treeAPI
=
tree
DB
treeAPI
=
tree
Advanced
------------------------------------------------------------------------
-- | Check if the name is less than 255 char
...
...
src/Gargantext/Database/Action/Share.hs
View file @
79e4ca7a
...
...
@@ -7,10 +7,8 @@ Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
-}
module
Gargantext.Database.Action.Share
where
...
...
src/Gargantext/Database/Query/Tree.hs
View file @
79e4ca7a
...
...
@@ -21,8 +21,8 @@ module Gargantext.Database.Query.Tree
(
module
Gargantext
.
Database
.
Query
.
Tree
.
Error
,
isDescendantOf
,
isIn
,
tree
DB
,
treeDB'
,
tree
,
TreeMode
(
..
)
,
findNodesId
,
DbTreeNode
(
..
)
,
dt_name
...
...
@@ -58,23 +58,36 @@ data DbTreeNode = DbTreeNode { _dt_nodeId :: NodeId
makeLenses
''
D
bTreeNode
------------------------------------------------------------------------
data
TreeMode
=
Basic
|
Advanced
-- | Returns the Tree of Nodes in Database
tree
::
HasTreeError
err
=>
TreeMode
->
RootId
->
[
NodeType
]
->
Cmd
err
(
Tree
NodeTree
)
tree
Basic
=
tree_basic
tree
Advanced
=
tree_advanced
-- | Tree basic returns the Tree of Nodes in Database
-- (without shared folders)
-- keeping this for teaching purpose only
tree
DB'
::
HasTreeError
err
tree
_basic
::
HasTreeError
err
=>
RootId
->
[
NodeType
]
->
Cmd
err
(
Tree
NodeTree
)
tree
DB'
r
nodeTypes
=
tree
_basic
r
nodeTypes
=
(
dbTree
r
nodeTypes
<&>
toTreeParent
)
>>=
toTree
-- Same as (but easier to read) :
-- toTree =<< (toTreeParent <$> dbTree r nodeTypes)
treeDB
::
HasTreeError
err
-- | Advanced mode of the Tree enables shared nodes
tree_advanced
::
HasTreeError
err
=>
RootId
->
[
NodeType
]
->
Cmd
err
(
Tree
NodeTree
)
tree
DB
r
nodeTypes
=
do
tree
_advanced
r
nodeTypes
=
do
mainRoot
<-
dbTree
r
nodeTypes
sharedRoots
<-
findShared
r
nodeTypes
toTree
$
toTreeParent
(
mainRoot
<>
sharedRoots
)
...
...
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