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
Christian Merten
purescript-gargantext
Commits
5807c509
Commit
5807c509
authored
Aug 21, 2024
by
Karen Konou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Graph explorer] Allow renaming
parent
b678ccdd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
6 deletions
+34
-6
API.purs
src/Gargantext/Components/GraphExplorer/API.purs
+9
-0
Layout.purs
src/Gargantext/Components/GraphExplorer/Layout.purs
+1
-0
Sidebar.purs
src/Gargantext/Components/GraphExplorer/Sidebar.purs
+4
-1
Legend.purs
src/Gargantext/Components/GraphExplorer/Sidebar/Legend.purs
+20
-5
No files found.
src/Gargantext/Components/GraphExplorer/API.purs
View file @
5807c509
...
...
@@ -88,6 +88,15 @@ type CloneGraphParams =
cloneGraph :: Record CloneGraphParams -> AffRESTError Int
cloneGraph { hyperdataGraph, id, session } = post session (GR.GraphAPI id $ "clone") hyperdataGraph
type UpdateLegendParams =
( graphId :: Int
, session :: Session
, legend :: Array GET.Legend
)
updateLegend :: Record UpdateLegendParams -> AffRESTError Int
updateLegend { graphId, session, legend } = post session (GR.GraphAPI graphId $ "legend") legend
-----------------------------------------------
getNodes :: Session -> T2.Reload -> GET.GraphId -> AffRESTError GET.HyperdataGraph
...
...
src/Gargantext/Components/GraphExplorer/Layout.purs
View file @
5807c509
...
...
@@ -179,6 +179,7 @@ layoutCpt = here.component "layout" cpt where
{ frontends: defaultFrontends
, metaData
, session
, graphId: graphId'
}
]
]
...
...
src/Gargantext/Components/GraphExplorer/Sidebar.purs
View file @
5807c509
...
...
@@ -55,6 +55,7 @@ type Props =
( metaData :: GET.MetaData
, session :: Session
, frontends :: Frontends
, graphId :: GET.GraphId
)
sidebar :: R2.Leaf Props
...
...
@@ -119,7 +120,7 @@ sideTabLegend :: R2.Leaf Props
sideTabLegend = R2.leaf sideTabLegendCpt
sideTabLegendCpt :: R.Component Props
sideTabLegendCpt = here.component "sideTabLegend" cpt where
cpt { metaData: GET.MetaData { legend } } _ = do
cpt { metaData: GET.MetaData { legend }
, session, graphId
} _ = do
-- | States
-- |
store <- GraphStore.use
...
...
@@ -164,6 +165,8 @@ sideTabLegendCpt = here.component "sideTabLegend" cpt where
, extractedNodeList
, nodeCountList
, selectedNodeIds: store.selectedNodeIds
, session
, graphId
}
]
...
...
src/Gargantext/Components/GraphExplorer/Sidebar/Legend.purs
View file @
5807c509
...
...
@@ -4,15 +4,21 @@ module Gargantext.Components.GraphExplorer.Sidebar.Legend
import Prelude hiding (map)
import Data.Array (fromFoldable)
import Data.Array as A
import Data.Maybe (isJust, maybe)
import Data.Sequence (Seq)
import Data.Sequence (Seq
, replace
)
import Data.Set as Set
import Data.Traversable (foldMap, intercalate)
import Effect (Effect)
import Effect.Aff (launchAff_)
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.GraphExplorer.API (updateLegend)
import Gargantext.Components.GraphExplorer.GraphTypes as GEGT
import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Components.Renameable (renameable)
import Gargantext.Hooks.Sigmax.Types as ST
import Gargantext.Sessions (Session)
import Gargantext.Utils (getter, nbsp, (?))
import Gargantext.Utils.Reactix as R2
import Reactix as R
...
...
@@ -27,6 +33,8 @@ type Props =
, extractedNodeList :: Array GEGT.Node
, nodeCountList :: Array GEGT.ClusterCount
, selectedNodeIds :: T.Box ST.NodeIds
, session :: Session
, graphId :: GET.GraphId
)
legend :: R2.Leaf Props
...
...
@@ -37,6 +45,8 @@ legendCpt = here.component "legend" cpt where
, extractedNodeList
, nodeCountList
, selectedNodeIds
, session
, graphId
} _ = do
-- | Hooks
-- |
...
...
@@ -48,7 +58,7 @@ legendCpt = here.component "legend" cpt where
H.ul
{ className: "graph-legend" }
[
flip foldMap legendSeq \(GET.Legend { id_, label
}) ->
flip foldMap legendSeq \(GET.Legend { id_, label
, color
}) ->
H.li
{ className: "graph-legend__item" }
...
...
@@ -62,9 +72,7 @@ legendCpt = here.component "legend" cpt where
B.wad
[ "flex-grow-1" ]
[
B.div'
{ className: "graph-legend__title" }
label
renameable { text: label, className: "graph-legend__label", onRename: \s -> rename s id_ color }
,
selectedNodes
{ selectedNodeIds
...
...
@@ -75,6 +83,13 @@ legendCpt = here.component "legend" cpt where
]
]
]
where
rename :: String -> Int -> String -> Effect Unit
rename s id c = do
let newLegendSeq = replace (GET.Legend $ { id_: id, label: s, color: c}) (id - 1) legendSeq
launchAff_ do
_ <- updateLegend { legend: (fromFoldable newLegendSeq), graphId, session }
pure unit
filterByCluster :: Int -> Array GEGT.Node -> Array GEGT.Node
filterByCluster id
...
...
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