Commit 694a2d1e authored by Karen Konou's avatar Karen Konou

[Graph explorer] Select nodes by clicking on the legend color

parent 5807c509
Pipeline #6513 passed with stages
in 24 minutes and 40 seconds
......@@ -4,6 +4,7 @@ module Gargantext.Components.GraphExplorer.Sidebar.Legend
import Prelude hiding (map)
import Control.Applicative (map)
import Data.Array (fromFoldable)
import Data.Array as A
import Data.Maybe (isJust, maybe)
......@@ -63,9 +64,10 @@ legendCpt = here.component "legend" cpt where
H.li
{ className: "graph-legend__item" }
[
H.div
H.button
{ className: "graph-legend__code"
, style: { backgroundColor: GET.intColor id_ }
, on: { click: \_ -> selectNodes id_}
}
[]
,
......@@ -91,6 +93,11 @@ legendCpt = here.component "legend" cpt where
_ <- updateLegend { legend: (fromFoldable newLegendSeq), graphId, session }
pure unit
selectNodes :: Int -> Effect Unit
selectNodes id = do
let nodes = filterByCluster id extractedNodeList
T.write_ (Set.fromFoldable $ map (\(GEGT.Node { id_ }) -> id_) nodes) selectedNodeIds
filterByCluster :: Int -> Array GEGT.Node -> Array GEGT.Node
filterByCluster id
= A.filter
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment