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
195
Issues
195
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
7649e70b
Commit
7649e70b
authored
Aug 19, 2024
by
Karen Konou
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Graph api] Legend update endpoint
parent
d6c03dc3
Pipeline
#6502
passed with stages
in 52 minutes and 7 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
10 deletions
+41
-10
Viz.hs
src/Gargantext/API/Routes/Named/Viz.hs
+6
-5
Viz.hs
src/Gargantext/API/Server/Named/Viz.hs
+6
-5
API.hs
src/Gargantext/Core/Viz/Graph/API.hs
+15
-0
Types.hs
src/Gargantext/Core/Viz/Graph/Types.hs
+14
-0
No files found.
src/Gargantext/API/Routes/Named/Viz.hs
View file @
7649e70b
...
@@ -53,11 +53,12 @@ newtype PostPhylo mode = PostPhylo
...
@@ -53,11 +53,12 @@ newtype PostPhylo mode = PostPhylo
-- | There is no Delete specific API for Graph since it can be deleted
-- | There is no Delete specific API for Graph since it can be deleted
-- as simple Node.
-- as simple Node.
data
GraphAPI
mode
=
GraphAPI
data
GraphAPI
mode
=
GraphAPI
{
getGraphEp
::
mode
:-
Get
'[
J
SON
]
HyperdataGraphAPI
{
getGraphEp
::
mode
:-
Get
'[
J
SON
]
HyperdataGraphAPI
,
getGraphAsyncEp
::
mode
:-
"async"
:>
NamedRoutes
GraphAsyncAPI
,
getGraphAsyncEp
::
mode
:-
"async"
:>
NamedRoutes
GraphAsyncAPI
,
cloneGraphEp
::
mode
:-
"clone"
:>
ReqBody
'[
J
SON
]
HyperdataGraphAPI
:>
Post
'[
J
SON
]
NodeId
,
cloneGraphEp
::
mode
:-
"clone"
:>
ReqBody
'[
J
SON
]
HyperdataGraphAPI
:>
Post
'[
J
SON
]
NodeId
,
gexfEp
::
mode
:-
"gexf"
:>
Get
'[
X
ML
]
(
Headers
'[
S
ervant
.
Header
"Content-Disposition"
Text
]
Graph
)
,
gexfEp
::
mode
:-
"gexf"
:>
Get
'[
X
ML
]
(
Headers
'[
S
ervant
.
Header
"Content-Disposition"
Text
]
Graph
)
,
graphVersionsAPI
::
mode
:-
"versions"
:>
NamedRoutes
GraphVersionsAPI
,
graphVersionsAPI
::
mode
:-
"versions"
:>
NamedRoutes
GraphVersionsAPI
,
updateGraphLegendEp
::
mode
:-
"legend"
:>
ReqBody
'[
J
SON
]
GraphLegendAPI
:>
Post
'[
J
SON
]
NodeId
}
deriving
Generic
}
deriving
Generic
...
...
src/Gargantext/API/Server/Named/Viz.hs
View file @
7649e70b
...
@@ -19,11 +19,12 @@ import Servant.Server.Generic (AsServerT)
...
@@ -19,11 +19,12 @@ import Servant.Server.Generic (AsServerT)
graphAPI
::
AuthenticatedUser
->
UserId
->
NodeId
->
Named
.
GraphAPI
(
AsServerT
(
GargM
Env
BackendInternalError
))
graphAPI
::
AuthenticatedUser
->
UserId
->
NodeId
->
Named
.
GraphAPI
(
AsServerT
(
GargM
Env
BackendInternalError
))
graphAPI
authenticatedUser
userId
n
=
withNamedAccess
authenticatedUser
(
PathNode
n
)
$
Named
.
GraphAPI
graphAPI
authenticatedUser
userId
n
=
withNamedAccess
authenticatedUser
(
PathNode
n
)
$
Named
.
GraphAPI
{
getGraphEp
=
getGraph
n
{
getGraphEp
=
getGraph
n
,
getGraphAsyncEp
=
graphAsync
n
,
getGraphAsyncEp
=
graphAsync
n
,
cloneGraphEp
=
graphClone
userId
n
,
cloneGraphEp
=
graphClone
userId
n
,
gexfEp
=
getGraphGexf
n
,
gexfEp
=
getGraphGexf
n
,
graphVersionsAPI
=
graphVersionsAPI
userId
n
,
graphVersionsAPI
=
graphVersionsAPI
userId
n
,
updateGraphLegendEp
=
updateGraphLegend
n
}
}
...
...
src/Gargantext/Core/Viz/Graph/API.hs
View file @
7649e70b
...
@@ -297,3 +297,18 @@ getGraphGexf :: HasNodeStory env err m
...
@@ -297,3 +297,18 @@ getGraphGexf :: HasNodeStory env err m
getGraphGexf
nId
=
do
getGraphGexf
nId
=
do
HyperdataGraphAPI
{
_hyperdataAPIGraph
=
graph
}
<-
getGraph
nId
HyperdataGraphAPI
{
_hyperdataAPIGraph
=
graph
}
<-
getGraph
nId
pure
$
addHeader
"attachment; filename=graph.gexf"
graph
pure
$
addHeader
"attachment; filename=graph.gexf"
graph
------------------------------------------------------------
updateGraphLegend
::
HasNodeError
err
=>
NodeId
->
GraphLegendAPI
->
DBCmd
err
NodeId
updateGraphLegend
nId
(
GraphLegendAPI
{
_graphAPILegend
=
lg
})
=
do
nodeGraph
<-
getNodeWith
nId
(
Proxy
::
Proxy
HyperdataGraph
)
let
graph
=
nodeGraph
^.
node_hyperdata
.
hyperdataGraph
case
graph
of
Nothing
->
pure
nId
Just
g
->
do
let
graph'
=
set
(
graph_metadata
.
_Just
.
gm_legend
)
lg
g
_
<-
updateHyperdata
nId
(
HyperdataGraph
(
Just
graph'
)
(
nodeGraph
^.
node_hyperdata
.
hyperdataCamera
))
pure
nId
src/Gargantext/Core/Viz/Graph/Types.hs
View file @
7649e70b
...
@@ -241,6 +241,20 @@ instance FromField HyperdataGraphAPI
...
@@ -241,6 +241,20 @@ instance FromField HyperdataGraphAPI
fromField
=
fromField'
fromField
=
fromField'
-----------------------------------------------------------
data
GraphLegendAPI
=
GraphLegendAPI
{
_graphAPILegend
::
[
LegendField
]
}
deriving
(
Show
,
Generic
)
$
(
deriveJSON
(
unPrefix
"_graphAPI"
)
''
G
raphLegendAPI
)
instance
ToSchema
GraphLegendAPI
where
declareNamedSchema
=
genericDeclareNamedSchema
(
unPrefixSwagger
"_graphAPI"
)
makeLenses
''
G
raphLegendAPI
instance
FromField
GraphLegendAPI
where
fromField
=
fromField'
---------------------- defaults
---------------------- defaults
...
...
Przemyslaw Kaminski
@cgenie
mentioned in commit
5660aec0
·
Oct 08, 2024
mentioned in commit
5660aec0
mentioned in commit 5660aec07ec5a0a0a5468f440092c1a8f57a864e
Toggle commit list
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