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
Grégoire Locqueville
purescript-gargantext
Commits
61bed3f7
Commit
61bed3f7
authored
Aug 09, 2019
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Graph] graph is loaded once, settings updated directly to sigma
parent
837ba3f4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
12 deletions
+20
-12
GraphExplorer.purs
src/Gargantext/Components/GraphExplorer.purs
+19
-12
Specs.purs
src/Gargantext/Pages/Layout/Specs.purs
+1
-0
No files found.
src/Gargantext/Components/GraphExplorer.purs
View file @
61bed3f7
...
@@ -55,6 +55,7 @@ type GraphId = Int
...
@@ -55,6 +55,7 @@ type GraphId = Int
type Props = (
type Props = (
graphId :: GraphId
graphId :: GraphId
, graph :: Maybe Graph.Graph
, mCurrentRoute :: Maybe Routes
, mCurrentRoute :: Maybe Routes
, treeId :: Maybe Int
, treeId :: Maybe Int
)
)
...
@@ -76,12 +77,22 @@ specCpt d stateGlue p = R.createElement el p []
...
@@ -76,12 +77,22 @@ specCpt d stateGlue p = R.createElement el p []
pure $ explorer state props
pure $ explorer state props
explorer :: Record GET.State -> Record Props -> R.Element
explorer :: Record GET.State -> Record Props -> R.Element
explorer state props = R.createElement (explorerCpt state) props []
explorer state props = R.createElement (explorerLoader state) props []
explorerLoader :: Record GET.State -> R.Component Props
explorerLoader state = R.hooksComponent "GraphExplorerLoader" cpt
where
cpt props _ = do
Loader.useLoader props.graphId getNodes $ \{loaded} ->
explorerEl state $ props {graph = Just $ convert loaded}
explorerEl :: Record GET.State -> Record Props -> R.Element
explorerEl state props = R.createElement (explorerCpt state) props []
explorerCpt :: Record GET.State -> R.Component Props
explorerCpt :: Record GET.State -> R.Component Props
explorerCpt state = R.hooksComponent "GraphExplorer" cpt
explorerCpt state = R.hooksComponent "GraphExplorer" cpt
where
where
cpt {graphId, mCurrentRoute, treeId} _ = do
cpt {graphId, mCurrentRoute, treeId
, graph
} _ = do
controls <- Controls.useGraphControls
controls <- Controls.useGraphControls
pure $
pure $
RH.div
RH.div
...
@@ -97,7 +108,7 @@ explorerCpt state = R.hooksComponent "GraphExplorer" cpt
...
@@ -97,7 +108,7 @@ explorerCpt state = R.hooksComponent "GraphExplorer" cpt
, col [ pullRight [ Toggle.sidebarToggleButton controls.showSidePanel ] ]
, col [ pullRight [ Toggle.sidebarToggleButton controls.showSidePanel ] ]
]
]
, row [ Controls.controls controls ]
, row [ Controls.controls controls ]
, row [ tree {mCurrentRoute, treeId} controls,
graphLoader graphId
controls, Sidebar.sidebar controls ]
, row [ tree {mCurrentRoute, treeId} controls,
mGraph {graphId, graph}
controls, Sidebar.sidebar controls ]
, row [ ]
, row [ ]
]
]
]
]
...
@@ -116,21 +127,17 @@ explorerCpt state = R.hooksComponent "GraphExplorer" cpt
...
@@ -116,21 +127,17 @@ explorerCpt state = R.hooksComponent "GraphExplorer" cpt
tree {mCurrentRoute, treeId: Just treeId} _ =
tree {mCurrentRoute, treeId: Just treeId} _ =
RH.div { className: "col-md-2" } [ Tree.elTreeview {mCurrentRoute, root: treeId} ]
RH.div { className: "col-md-2" } [ Tree.elTreeview {mCurrentRoute, root: treeId} ]
graphLoader :: GraphId -> Record Controls.Controls -> R.Element
mGraph :: {graphId :: GraphId, graph :: Maybe Graph.Graph} -> Record Controls.Controls -> R.Element
graphLoader graphId controls = R.createElement el {} []
mGraph {graph: Nothing} _ = RH.div {} []
where
mGraph {graphId, graph: Just graph} controls = graphView controls {graphId, graph}
el = R.hooksComponent "GraphLoader" cpt
cpt {} _children = do
Loader.useLoader graphId getNodes $ \{loaded} ->
loadedGraphView controls {graphId, graph: convert loaded}
type GraphProps = (
type GraphProps = (
graphId :: GraphId
graphId :: GraphId
, graph :: Graph.Graph
, graph :: Graph.Graph
)
)
loadedG
raphView :: Record Controls.Controls -> Record GraphProps -> R.Element
g
raphView :: Record Controls.Controls -> Record GraphProps -> R.Element
loadedG
raphView controls props = R.createElement el props []
g
raphView controls props = R.createElement el props []
where
where
el = R.hooksComponent "GraphView" cpt
el = R.hooksComponent "GraphView" cpt
cpt {graphId, graph} _children = do
cpt {graphId, graph} _children = do
...
...
src/Gargantext/Pages/Layout/Specs.purs
View file @
61bed3f7
...
@@ -71,6 +71,7 @@ pagesComponent s = case s.currentRoute of
...
@@ -71,6 +71,7 @@ pagesComponent s = case s.currentRoute of
graphSpec i = layout1 $ withState \st ->
graphSpec i = layout1 $ withState \st ->
cmapProps (const {
cmapProps (const {
graphId: i
graphId: i
, graph: Nothing
, mCurrentRoute: st.currentRoute
, mCurrentRoute: st.currentRoute
, treeId: case st.loginState.authData of
, treeId: case st.loginState.authData of
Nothing -> Nothing
Nothing -> Nothing
...
...
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