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
9f0a0a6a
Commit
9f0a0a6a
authored
Sep 05, 2020
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[graph] reload tree after graph cloning
parent
2b22fc81
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
17 deletions
+41
-17
App.purs
src/Gargantext/Components/App.purs
+2
-1
GraphExplorer.purs
src/Gargantext/Components/GraphExplorer.purs
+12
-4
Button.purs
src/Gargantext/Components/GraphExplorer/Button.purs
+7
-2
Controls.purs
src/Gargantext/Components/GraphExplorer/Controls.purs
+16
-7
Version.purs
src/Gargantext/Version.purs
+4
-3
No files found.
src/Gargantext/Components/App.purs
View file @
9f0a0a6a
...
@@ -104,7 +104,8 @@ appCpt = R.hooksComponent "G.C.App.app" cpt where
...
@@ -104,7 +104,8 @@ appCpt = R.hooksComponent "G.C.App.app" cpt where
, session
, session
, sessions: (fst sessions)
, sessions: (fst sessions)
, showLogin
, showLogin
, treeReload }
--, treeReload
}
type ForestLayoutProps =
type ForestLayoutProps =
( child :: R.Element
( child :: R.Element
...
...
src/Gargantext/Components/GraphExplorer.purs
View file @
9f0a0a6a
...
@@ -45,7 +45,7 @@ type LayoutProps =
...
@@ -45,7 +45,7 @@ type LayoutProps =
, session :: Session
, session :: Session
, sessions :: Sessions
, sessions :: Sessions
, showLogin :: R.State Boolean
, showLogin :: R.State Boolean
, treeReload :: R.State Int
--
, treeReload :: R.State Int
)
)
type Props = (
type Props = (
...
@@ -99,7 +99,8 @@ explorerCpt = R.hooksComponent "G.C.GraphExplorer.explorer" cpt
...
@@ -99,7 +99,8 @@ explorerCpt = R.hooksComponent "G.C.GraphExplorer.explorer" cpt
, session
, session
, sessions
, sessions
, showLogin
, showLogin
, treeReload } _ = do
--, treeReload
} _ = do
let startForceAtlas = maybe true (\(GET.MetaData { startForceAtlas }) -> startForceAtlas) mMetaData
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
...
@@ -107,7 +108,14 @@ explorerCpt = R.hooksComponent "G.C.GraphExplorer.explorer" cpt
...
@@ -107,7 +108,14 @@ explorerCpt = R.hooksComponent "G.C.GraphExplorer.explorer" cpt
dataRef <- R.useRef graph
dataRef <- R.useRef graph
graphRef <- R.useRef null
graphRef <- R.useRef null
graphVersionRef <- R.useRef (fst graphVersion)
graphVersionRef <- R.useRef (fst graphVersion)
controls <- Controls.useGraphControls graph graphId hyperdataGraph session forceAtlasS
treeReload <- R.useState' 0
controls <- Controls.useGraphControls { forceAtlasS
, graph
, graphId
, hyperdataGraph
, session
, treeReload: \_ -> (snd treeReload) $ (+) 1
}
multiSelectEnabledRef <- R.useRef $ fst controls.multiSelectEnabled
multiSelectEnabledRef <- R.useRef $ fst controls.multiSelectEnabled
R.useEffect' $ do
R.useEffect' $ do
...
@@ -144,7 +152,7 @@ explorerCpt = R.hooksComponent "G.C.GraphExplorer.explorer" cpt
...
@@ -144,7 +152,7 @@ explorerCpt = R.hooksComponent "G.C.GraphExplorer.explorer" cpt
tree { frontends
tree { frontends
, handed
, handed
, mCurrentRoute
, mCurrentRoute
, reload:
props.
treeReload
, reload: treeReload
, sessions
, sessions
, show: fst controls.showTree
, show: fst controls.showTree
, showLogin: snd showLogin }
, showLogin: snd showLogin }
...
...
src/Gargantext/Components/GraphExplorer/Button.purs
View file @
9f0a0a6a
...
@@ -15,6 +15,7 @@ import Data.String as DS
...
@@ -15,6 +15,7 @@ import Data.String as DS
import DOM.Simple.Console (log2)
import DOM.Simple.Console (log2)
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (launchAff_)
import Effect.Aff (launchAff_)
import Effect.Class (liftEffect)
import Effect.Now as EN
import Effect.Now as EN
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
...
@@ -62,6 +63,7 @@ type CameraButtonProps = (
...
@@ -62,6 +63,7 @@ type CameraButtonProps = (
, hyperdataGraph :: GET.HyperdataGraph
, hyperdataGraph :: GET.HyperdataGraph
, session :: Session
, session :: Session
, sigmaRef :: R.Ref Sigmax.Sigma
, sigmaRef :: R.Ref Sigmax.Sigma
, treeReload :: Unit -> Effect Unit
)
)
...
@@ -69,7 +71,8 @@ cameraButton :: Record CameraButtonProps -> R.Element
...
@@ -69,7 +71,8 @@ cameraButton :: Record CameraButtonProps -> R.Element
cameraButton { id
cameraButton { id
, hyperdataGraph: GET.HyperdataGraph { graph: GET.GraphData hyperdataGraph }
, hyperdataGraph: GET.HyperdataGraph { graph: GET.GraphData hyperdataGraph }
, session
, session
, sigmaRef } = simpleButton {
, sigmaRef
, treeReload } = simpleButton {
onClick: \_ -> do
onClick: \_ -> do
let sigma = R.readRef sigmaRef
let sigma = R.readRef sigmaRef
Sigmax.dependOnSigma sigma "[cameraButton] sigma: Nothing" $ \s -> do
Sigmax.dependOnSigma sigma "[cameraButton] sigma: Nothing" $ \s -> do
...
@@ -100,6 +103,8 @@ cameraButton { id
...
@@ -100,6 +103,8 @@ cameraButton { id
, mCamera: Just camera }
, mCamera: Just camera }
launchAff_ $ do
launchAff_ $ do
clonedGraphId <- cloneGraph { id, hyperdataGraph, session }
clonedGraphId <- cloneGraph { id, hyperdataGraph, session }
uploadArbitraryDataURL session clonedGraphId (Just $ nowStr <> "-" <> "screenshot.png") screen
ret <- uploadArbitraryDataURL session clonedGraphId (Just $ nowStr <> "-" <> "screenshot.png") screen
liftEffect $ treeReload unit
pure ret
, text: "Screenshot"
, text: "Screenshot"
}
}
src/Gargantext/Components/GraphExplorer/Controls.purs
View file @
9f0a0a6a
...
@@ -52,6 +52,7 @@ type Controls =
...
@@ -52,6 +52,7 @@ type Controls =
, showSidePanel :: R.State GET.SidePanelState
, showSidePanel :: R.State GET.SidePanelState
, showTree :: R.State Boolean
, showTree :: R.State Boolean
, sigmaRef :: R.Ref Sigmax.Sigma
, sigmaRef :: R.Ref Sigmax.Sigma
, treeReload :: Unit -> Effect Unit
)
)
type LocalControls =
type LocalControls =
...
@@ -165,18 +166,25 @@ controlsCpt = R.hooksComponent "GraphControls" cpt
...
@@ -165,18 +166,25 @@ controlsCpt = R.hooksComponent "GraphControls" cpt
, RH.li {} [ cameraButton { id: props.graphId
, RH.li {} [ cameraButton { id: props.graphId
, hyperdataGraph: props.hyperdataGraph
, hyperdataGraph: props.hyperdataGraph
, session: props.session
, session: props.session
, sigmaRef: props.sigmaRef } ]
, sigmaRef: props.sigmaRef
, treeReload: props.treeReload } ]
]
]
]
]
]
]
useGraphControls :: SigmaxT.SGraph
useGraphControls :: { forceAtlasS :: SigmaxT.ForceAtlasState
-> GET.GraphId
, graph :: SigmaxT.SGraph
-> GET.HyperdataGraph
, graphId :: GET.GraphId
-> Session
, hyperdataGraph :: GET.HyperdataGraph
-> SigmaxT.ForceAtlasState
, session :: Session
, treeReload :: Unit -> Effect Unit }
-> R.Hooks (Record Controls)
-> R.Hooks (Record Controls)
useGraphControls graph graphId hyperdataGraph session forceAtlasS = do
useGraphControls { forceAtlasS
, graph
, graphId
, hyperdataGraph
, session
, treeReload } = do
edgeConfluence <- R.useState' $ Range.Closed { min: 0.0, max: 1.0 }
edgeConfluence <- R.useState' $ Range.Closed { min: 0.0, max: 1.0 }
edgeWeight <- R.useState' $ Range.Closed {
edgeWeight <- R.useState' $ Range.Closed {
min: 0.0
min: 0.0
...
@@ -214,6 +222,7 @@ useGraphControls graph graphId hyperdataGraph session forceAtlasS = do
...
@@ -214,6 +222,7 @@ useGraphControls graph graphId hyperdataGraph session forceAtlasS = do
, showSidePanel
, showSidePanel
, showTree
, showTree
, sigmaRef
, sigmaRef
, treeReload
}
}
getShowControls :: Record Controls -> Boolean
getShowControls :: Record Controls -> Boolean
...
...
src/Gargantext/Version.purs
View file @
9f0a0a6a
...
@@ -4,13 +4,14 @@ import Data.Maybe (Maybe(..))
...
@@ -4,13 +4,14 @@ import Data.Maybe (Maybe(..))
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff, launchAff_)
import Effect.Aff (Aff, launchAff_)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Prelude
import Reactix as R
import Reactix.DOM.HTML as H
import Gargantext.Config.REST as REST
import Gargantext.Config.REST as REST
import Gargantext.Ends (toUrl)
import Gargantext.Ends (toUrl)
import Gargantext.Sessions (Session(..))
import Gargantext.Sessions (Session(..))
import Gargantext.Sessions as Sessions
import Gargantext.Sessions as Sessions
import Prelude
import Reactix as R
import Reactix.DOM.HTML as H
type Version = String
type Version = String
...
...
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