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
199
Issues
199
List
Board
Labels
Milestones
Merge Requests
12
Merge Requests
12
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
1fdd677f
Commit
1fdd677f
authored
May 26, 2023
by
Karen Konou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Tree flat] Filter results on backend
parent
2fcc7fd7
Pipeline
#4067
failed with stage
in 128 minutes and 27 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
Node.hs
src/Gargantext/API/Node.hs
+1
-0
Tree.hs
src/Gargantext/Database/Query/Tree.hs
+7
-2
No files found.
src/Gargantext/API/Node.hs
View file @
1fdd677f
...
@@ -337,6 +337,7 @@ treeAPI id = tree TreeAdvanced id
...
@@ -337,6 +337,7 @@ treeAPI id = tree TreeAdvanced id
:<|>
tree
TreeFirstLevel
id
:<|>
tree
TreeFirstLevel
id
type
TreeFlatAPI
=
QueryParams
"type"
NodeType
type
TreeFlatAPI
=
QueryParams
"type"
NodeType
:>
QueryParam
"query"
Text
:>
Get
'[
J
SON
]
[
NodeTree
]
:>
Get
'[
J
SON
]
[
NodeTree
]
treeFlatAPI
::
NodeId
->
GargServer
TreeFlatAPI
treeFlatAPI
::
NodeId
->
GargServer
TreeFlatAPI
...
...
src/Gargantext/Database/Query/Tree.hs
View file @
1fdd677f
...
@@ -44,6 +44,7 @@ import Control.Lens (view, toListOf, at, each, _Just, to, set, makeLenses)
...
@@ -44,6 +44,7 @@ import Control.Lens (view, toListOf, at, each, _Just, to, set, makeLenses)
import
Control.Monad.Error.Class
(
MonadError
())
import
Control.Monad.Error.Class
(
MonadError
())
import
Data.List
(
tail
,
concat
,
nub
)
import
Data.List
(
tail
,
concat
,
nub
)
import
qualified
Data.List
as
List
import
qualified
Data.List
as
List
import
qualified
Data.Text
as
Text
import
Data.Map.Strict
(
Map
,
fromListWith
,
lookup
)
import
Data.Map.Strict
(
Map
,
fromListWith
,
lookup
)
-- import Data.Monoid (mconcat)
-- import Data.Monoid (mconcat)
import
Data.Proxy
import
Data.Proxy
...
@@ -148,12 +149,16 @@ tree_first_level r nodeTypes = do
...
@@ -148,12 +149,16 @@ tree_first_level r nodeTypes = do
tree_flat
::
(
HasTreeError
err
,
HasNodeError
err
)
tree_flat
::
(
HasTreeError
err
,
HasNodeError
err
)
=>
RootId
=>
RootId
->
[
NodeType
]
->
[
NodeType
]
->
Maybe
Text
->
Cmd
err
[
NodeTree
]
->
Cmd
err
[
NodeTree
]
tree_flat
r
nodeTypes
=
do
tree_flat
r
nodeTypes
q
=
do
mainRoot
<-
findNodes
r
Private
nodeTypes
mainRoot
<-
findNodes
r
Private
nodeTypes
publicRoots
<-
findNodes
r
PublicDirect
nodeTypes
publicRoots
<-
findNodes
r
PublicDirect
nodeTypes
sharedRoots
<-
findNodes
r
SharedDirect
nodeTypes
sharedRoots
<-
findNodes
r
SharedDirect
nodeTypes
pure
$
map
toNodeTree
(
mainRoot
<>
sharedRoots
<>
publicRoots
)
let
ret
=
map
toNodeTree
(
mainRoot
<>
sharedRoots
<>
publicRoots
)
case
q
of
Just
v
->
pure
$
filter
(
\
(
NodeTree
{
_nt_name
})
->
Text
.
isInfixOf
(
Text
.
toLower
v
)
(
Text
.
toLower
_nt_name
))
ret
Nothing
->
pure
$
ret
------------------------------------------------------------------------
------------------------------------------------------------------------
...
...
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