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
142
Issues
142
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
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
purescript-gargantext
Commits
e32bc4a6
Commit
e32bc4a6
authored
Sep 15, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX]
#205
GraphExplorer, still needs to lower the loader when recomputing (TODO)
parent
162bd7ff
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
53 deletions
+57
-53
GraphExplorer.purs
src/Gargantext/Components/GraphExplorer.purs
+42
-38
Controls.purs
src/Gargantext/Components/GraphExplorer/Controls.purs
+1
-1
Types.purs
src/Gargantext/Components/GraphExplorer/Types.purs
+14
-14
No files found.
src/Gargantext/Components/GraphExplorer.purs
View file @
e32bc4a6
...
...
@@ -40,20 +40,20 @@ import Gargantext.Utils.Reactix as R2
thisModule = "Gargantext.Components.GraphExplorer"
type LayoutProps =
( frontends :: Frontends
, graphId :: GET.GraphId
, handed :: Types.Handed
( frontends
:: Frontends
, graphId
:: GET.GraphId
, handed
:: Types.Handed
, mCurrentRoute :: AppRoute
, session :: Session
, sessions :: Sessions
, showLogin :: R.State Boolean
, session
:: Session
, sessions
:: Sessions
, showLogin
:: R.State Boolean
)
type Props =
(
graph
:: SigmaxT.SGraph
, graphVersion :: R.State Int
type Props =
( graph
:: SigmaxT.SGraph
, graphVersion
:: R.State Int
, hyperdataGraph :: GET.HyperdataGraph
, mMetaData :: Maybe GET.MetaData
, mMetaData
:: Maybe GET.MetaData
| LayoutProps
)
...
...
@@ -66,7 +66,6 @@ explorerLayoutCpt = R2.hooksComponent thisModule "explorerLayout" cpt
where
cpt props _ = do
graphVersion <- R.useState' 0
pure $ explorerLayoutView graphVersion props
explorerLayoutView :: R.State Int -> Record LayoutProps -> R.Element
...
...
@@ -103,19 +102,22 @@ explorerCpt = R2.hooksComponent thisModule "explorer" cpt
} _ = do
let startForceAtlas = maybe true (\(GET.MetaData { startForceAtlas }) -> startForceAtlas) mMetaData
let forceAtlasS = if startForceAtlas then SigmaxT.InitialRunning else SigmaxT.InitialStopped
let forceAtlasS = if startForceAtlas
then SigmaxT.InitialRunning
else SigmaxT.InitialStopped
dataRef <- R.useRef graph
graphRef <- R.useRef null
graphVersionRef <- R.useRef (fst graphVersion)
treeReload <- R.useState' 0
controls
<- Controls.useGraphControls { forceAtlasS
, graph
, graphId
, hyperdataGraph
, session
, treeReload: \_ -> (snd treeReload) $ (+) 1
}
controls <- Controls.useGraphControls { forceAtlasS
, graph
, graphId
, hyperdataGraph
, session
, treeReload: \_ -> (snd treeReload) $ (+) 1
}
multiSelectEnabledRef <- R.useRef $ fst controls.multiSelectEnabled
R.useEffect' $ do
...
...
@@ -184,13 +186,13 @@ explorerCpt = R2.hooksComponent thisModule "explorer" cpt
]
mainLayout Types.RightHanded (tree' /\ gc /\ gv /\ sdb) = [tree', gc, gv, sdb]
mainLayout Types.LeftHanded (tree' /\ gc /\ gv /\ sdb) = [sdb, gc, gv, tree']
mainLayout Types.LeftHanded
(tree' /\ gc /\ gv /\ sdb) = [sdb, gc, gv, tree']
outer = RH.div { className: "col-md-12" }
inner h = RH.div { className: "container-fluid " <> hClass }
where
hClass = case h of
Types.LeftHanded -> "lefthanded"
Types.LeftHanded
-> "lefthanded"
Types.RightHanded -> "righthanded"
rowToggle = RH.div { id: "toggle-container" }
rowControls = RH.div { id: "controls-container" }
...
...
@@ -275,20 +277,19 @@ graphViewCpt = R2.hooksComponent thisModule "graphView" cpt
R.useEffect1' (fst controls.multiSelectEnabled) $ do
R.setRef multiSelectEnabledRef $ fst controls.multiSelectEnabled
pure $ Graph.graph {
elRef
, forceAtlas2Settings: Graph.forceAtlas2Settings
, graph
, mCamera
, multiSelectEnabledRef
, selectedNodeIds: controls.selectedNodeIds
, showEdges: controls.showEdges
, sigmaRef: controls.sigmaRef
, sigmaSettings: Graph.sigmaSettings
, stage: controls.graphStage
, startForceAtlas
, transformedGraph
}
pure $ Graph.graph { elRef
, forceAtlas2Settings: Graph.forceAtlas2Settings
, graph
, mCamera
, multiSelectEnabledRef
, selectedNodeIds: controls.selectedNodeIds
, showEdges: controls.showEdges
, sigmaRef: controls.sigmaRef
, sigmaSettings: Graph.sigmaSettings
, stage: controls.graphStage
, startForceAtlas
, transformedGraph
}
convert :: GET.GraphData -> Tuple (Maybe GET.MetaData) SigmaxT.SGraph
convert (GET.GraphData r) = Tuple r.metaData $ SigmaxT.Graph {nodes, edges}
...
...
@@ -344,7 +345,10 @@ modeGraphType Types.Terms = "def"
getNodes :: Session -> R.State Int -> GET.GraphId -> Aff GET.HyperdataGraph
getNodes session (graphVersion /\ _) graphId = get session $ NodeAPI Types.Graph (Just graphId) ("?version=" <> show graphVersion)
getNodes session (graphVersion /\ _) graphId =
get session $ NodeAPI Types.Graph
(Just graphId)
("?version=" <> show graphVersion)
transformGraph :: Record Controls.Controls -> SigmaxT.SGraph -> SigmaxT.SGraph
...
...
@@ -361,8 +365,8 @@ transformGraph controls graph = SigmaxT.Graph {nodes: newNodes, edges: newEdges}
--newNodes = Seq.map (nodeSizeFilter <<< nodeMarked) nodes
--newEdges = Seq.map (edgeConfluenceFilter <<< edgeWeightFilter <<< edgeShowFilter <<< edgeMarked) edges
newEdges' = Seq.filter edgeFilter $ Seq.map (edgeShowFilter <<< edgeMarked) edges
newNodes = Seq.filter nodeFilter $ Seq.map (nodeMarked) nodes
newEdges = Seq.filter (edgeInGraph $ Set.fromFoldable $ Seq.map _.id newNodes) newEdges'
newNodes
= Seq.filter nodeFilter $ Seq.map (nodeMarked) nodes
newEdges
= Seq.filter (edgeInGraph $ Set.fromFoldable $ Seq.map _.id newNodes) newEdges'
edgeFilter e = edgeConfluenceFilter e &&
edgeWeightFilter e
...
...
src/Gargantext/Components/GraphExplorer/Controls.purs
View file @
e32bc4a6
...
...
@@ -109,7 +109,7 @@ controlsCpt = R2.hooksComponent thisModule "controls" cpt
-- CPU, has memory leaks etc.
R.useEffect1' (fst props.forceAtlasState) $ do
if (fst props.forceAtlasState) == SigmaxT.InitialRunning then do
timeoutId <- setTimeout
2
000 $ do
timeoutId <- setTimeout
9
000 $ do
let (toggled /\ setToggled) = props.forceAtlasState
case toggled of
SigmaxT.InitialRunning -> setToggled $ const SigmaxT.Paused
...
...
src/Gargantext/Components/GraphExplorer/Types.purs
View file @
e32bc4a6
...
...
@@ -157,7 +157,7 @@ instance decodeJsonNode :: DecodeJson Node where
id_ <- obj .: "id"
type_ <- obj .: "type"
label <- obj .: "label"
size <- obj .: "size"
size
<- obj .: "size"
attributes <- obj .: "attributes"
x <- obj .: "x_coord"
y <- obj .: "y_coord"
...
...
@@ -177,14 +177,14 @@ instance encodeJsonNode :: EncodeJson Node where
instance decodeJsonMetaData :: DecodeJson MetaData where
decodeJson json = do
obj <- decodeJson json
legend <- obj .: "legend"
obj
<- decodeJson json
legend
<- obj .: "legend"
corpusId <- obj .: "corpusId"
list <- obj .: "list"
listId <- list .: "listId"
metric <- obj .: "metric"
list
<- obj .: "list"
listId
<- list .: "listId"
metric
<- obj .: "metric"
startForceAtlas <- obj .: "startForceAtlas"
title <- obj .: "title"
title
<- obj .: "title"
version <- list .: "version"
pure $ MetaData {
corpusId
...
...
@@ -208,7 +208,7 @@ instance encodeJsonMetaData :: EncodeJson MetaData where
instance decodeJsonLegend :: DecodeJson Legend where
decodeJson json = do
obj <- decodeJson json
id_ <- obj .: "id"
id_
<- obj .: "id"
color <- obj .: "color"
label <- obj .: "label"
pure $ Legend { id_, color, label }
...
...
@@ -286,11 +286,11 @@ instance showSideTab :: Show SideTab where
show SideTabCommunity = "Community"
newtype Camera =
Camera {
ratio :: Number
, x :: Number
, y :: Number
}
newtype Camera =
Camera {
ratio :: Number
, x :: Number
, y :: Number
}
instance decodeCamera :: DecodeJson Camera where
decodeJson json = do
...
...
@@ -315,7 +315,7 @@ newtype HyperdataGraph = HyperdataGraph {
instance decodeHyperdataGraph :: DecodeJson HyperdataGraph where
decodeJson json = do
obj
<- decodeJson json
obj <- decodeJson json
graph <- obj .: "graph"
mCamera <- obj .:? "camera"
pure $ HyperdataGraph { graph, mCamera }
...
...
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