Commit 1833bad9 authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge remote-tracking branch 'origin/dev-graph-explorer-save-gexf' into dev-merge

parents 9e975cf6 a051df3e
...@@ -140,6 +140,7 @@ explorerCpt = R.hooksComponent "G.C.GraphExplorer.explorer" cpt ...@@ -140,6 +140,7 @@ explorerCpt = R.hooksComponent "G.C.GraphExplorer.explorer" cpt
} }
, mSidebar mMetaData { frontends , mSidebar mMetaData { frontends
, graph , graph
, graphId
, graphVersion , graphVersion
, removedNodeIds: controls.removedNodeIds , removedNodeIds: controls.removedNodeIds
, session , session
...@@ -171,6 +172,7 @@ explorerCpt = R.hooksComponent "G.C.GraphExplorer.explorer" cpt ...@@ -171,6 +172,7 @@ explorerCpt = R.hooksComponent "G.C.GraphExplorer.explorer" cpt
mSidebar :: Maybe GET.MetaData mSidebar :: Maybe GET.MetaData
-> { frontends :: Frontends -> { frontends :: Frontends
, graph :: SigmaxT.SGraph , graph :: SigmaxT.SGraph
, graphId :: GraphId
, graphVersion :: R.State Int , graphVersion :: R.State Int
, removedNodeIds :: R.State SigmaxT.NodeIds , removedNodeIds :: R.State SigmaxT.NodeIds
, showSidePanel :: GET.SidePanelState , showSidePanel :: GET.SidePanelState
...@@ -178,9 +180,10 @@ explorerCpt = R.hooksComponent "G.C.GraphExplorer.explorer" cpt ...@@ -178,9 +180,10 @@ explorerCpt = R.hooksComponent "G.C.GraphExplorer.explorer" cpt
, session :: Session } , session :: Session }
-> R.Element -> R.Element
mSidebar Nothing _ = RH.div {} [] mSidebar Nothing _ = RH.div {} []
mSidebar (Just metaData) {frontends, graph, graphVersion, removedNodeIds, session, selectedNodeIds, showSidePanel} = mSidebar (Just metaData) {frontends, graph, graphId, graphVersion, removedNodeIds, session, selectedNodeIds, showSidePanel} =
Sidebar.sidebar { frontends Sidebar.sidebar { frontends
, graph , graph
, graphId
, graphVersion , graphVersion
, metaData , metaData
, removedNodeIds , removedNodeIds
......
...@@ -24,15 +24,18 @@ import Gargantext.Components.NgramsTable.Core as NTC ...@@ -24,15 +24,18 @@ import Gargantext.Components.NgramsTable.Core as NTC
import Gargantext.Components.Nodes.Corpus.Graph.Tabs as GT import Gargantext.Components.Nodes.Corpus.Graph.Tabs as GT
import Gargantext.Components.RandomText (words) import Gargantext.Components.RandomText (words)
import Gargantext.Data.Array (mapMaybe) import Gargantext.Data.Array (mapMaybe)
import Gargantext.Ends (Frontends) import Gargantext.Ends (Frontends, url)
import Gargantext.Hooks.Sigmax.Types as SigmaxT import Gargantext.Hooks.Sigmax.Types as SigmaxT
import Gargantext.Routes as Routes
import Gargantext.Sessions (Session) import Gargantext.Sessions (Session)
import Gargantext.Types (CTabNgramType, TabSubType(..), TabType(..), TermList(..), modeTabType) import Gargantext.Types (CTabNgramType, TabSubType(..), TabType(..), TermList(..), modeTabType)
import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
type Props = type Props =
( frontends :: Frontends ( frontends :: Frontends
, graph :: SigmaxT.SGraph , graph :: SigmaxT.SGraph
, graphId :: Int
, graphVersion :: R.State Int , graphVersion :: R.State Int
, metaData :: GET.MetaData , metaData :: GET.MetaData
, removedNodeIds :: R.State SigmaxT.NodeIds , removedNodeIds :: R.State SigmaxT.NodeIds
...@@ -64,6 +67,11 @@ sidebarCpt = R.hooksComponent "Sidebar" cpt ...@@ -64,6 +67,11 @@ sidebarCpt = R.hooksComponent "Sidebar" cpt
[ RH.div { className: "", role: "tabpanel" } [ RH.div { className: "", role: "tabpanel" }
(Seq.toUnfoldable $ (Seq.map (badge props.selectedNodeIds) (badges props.graph props.selectedNodeIds))) (Seq.toUnfoldable $ (Seq.map (badge props.selectedNodeIds) (badges props.graph props.selectedNodeIds)))
] ]
, RH.div { className: "gexf" } [
RH.a { className: "btn btn-default"
, href: gexfHref props.session props.graphId
, target: "_blank" } [ RH.text "Download GEXF" ]
]
, RH.div { className: "tab-content" } , RH.div { className: "tab-content" }
[ [
removeButton "Remove candidate" CandidateTerm props nodesMap removeButton "Remove candidate" CandidateTerm props nodesMap
...@@ -123,6 +131,9 @@ sidebarCpt = R.hooksComponent "Sidebar" cpt ...@@ -123,6 +131,9 @@ sidebarCpt = R.hooksComponent "Sidebar" cpt
snd props.removedNodeIds $ const $ fst props.selectedNodeIds snd props.removedNodeIds $ const $ fst props.selectedNodeIds
snd props.selectedNodeIds $ const SigmaxT.emptyNodeIds snd props.selectedNodeIds $ const SigmaxT.emptyNodeIds
gexfHref :: Session -> Int -> String
gexfHref session graphId = url session $ Routes.NodeAPI GT.Graph (Just graphId) "gexf"
badge :: R.State SigmaxT.NodeIds -> Record SigmaxT.Node -> R.Element badge :: R.State SigmaxT.NodeIds -> Record SigmaxT.Node -> R.Element
badge (_ /\ setNodeIds) {id, label} = badge (_ /\ setNodeIds) {id, label} =
......
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