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
148
Issues
148
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
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
c03222b2
Commit
c03222b2
authored
Feb 11, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[graph explorer] refresh tree when screenshot is made
parent
69038bce
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
17 deletions
+33
-17
GraphExplorer.purs
src/Gargantext/Components/GraphExplorer.purs
+2
-1
Button.purs
src/Gargantext/Components/GraphExplorer/Button.purs
+16
-7
Controls.purs
src/Gargantext/Components/GraphExplorer/Controls.purs
+15
-9
No files found.
src/Gargantext/Components/GraphExplorer.purs
View file @
c03222b2
...
@@ -120,7 +120,8 @@ explorerCpt = R.hooksComponentWithModule thisModule "explorer" cpt
...
@@ -120,7 +120,8 @@ explorerCpt = R.hooksComponentWithModule thisModule "explorer" cpt
graphVersionRef <- R.useRef (GUR.value graphVersion)
graphVersionRef <- R.useRef (GUR.value graphVersion)
treeReload <- GUR.new
treeReload <- GUR.new
treeReloadRef <- GUR.newIInitialized treeReload
treeReloadRef <- GUR.newIInitialized treeReload
controls <- Controls.useGraphControls { forceAtlasS
controls <- Controls.useGraphControls { asyncTasksRef
, forceAtlasS
, graph
, graph
, graphId
, graphId
, hyperdataGraph
, hyperdataGraph
...
...
src/Gargantext/Components/GraphExplorer/Button.purs
View file @
c03222b2
...
@@ -7,11 +7,12 @@ module Gargantext.Components.GraphExplorer.Button
...
@@ -7,11 +7,12 @@ module Gargantext.Components.GraphExplorer.Button
import Prelude
import Prelude
import Data.Enum (fromEnum)
import Data.Maybe (Maybe(..))
import Data.DateTime as DDT
import Data.DateTime as DDT
import Data.DateTime.Instant as DDI
import Data.DateTime.Instant as DDI
import Data.Enum (fromEnum)
import Data.Maybe (Maybe(..))
import Data.String as DS
import Data.String as DS
import Data.Tuple (snd)
import DOM.Simple.Console (log2)
import DOM.Simple.Console (log2)
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (launchAff_)
import Effect.Aff (launchAff_)
...
@@ -20,6 +21,7 @@ import Effect.Now as EN
...
@@ -20,6 +21,7 @@ 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
import Gargantext.AsyncTasks as GAT
import Gargantext.Components.Forest.Tree.Node.Action.Upload (uploadArbitraryDataURL)
import Gargantext.Components.Forest.Tree.Node.Action.Upload (uploadArbitraryDataURL)
import Gargantext.Components.GraphExplorer.API (cloneGraph)
import Gargantext.Components.GraphExplorer.API (cloneGraph)
import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Components.GraphExplorer.Types as GET
...
@@ -29,6 +31,7 @@ import Gargantext.Hooks.Sigmax.Sigma as Sigma
...
@@ -29,6 +31,7 @@ import Gargantext.Hooks.Sigmax.Sigma as Sigma
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
thisModule :: String
thisModule = "Gargantext.Components.GraphExplorer.Button"
thisModule = "Gargantext.Components.GraphExplorer.Button"
type Props = (
type Props = (
...
@@ -58,7 +61,8 @@ centerButton sigmaRef = simpleButton {
...
@@ -58,7 +61,8 @@ centerButton sigmaRef = simpleButton {
type CameraButtonProps = (
type CameraButtonProps = (
id :: Int
asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, id :: Int
, hyperdataGraph :: GET.HyperdataGraph
, hyperdataGraph :: GET.HyperdataGraph
, session :: Session
, session :: Session
, sigmaRef :: R.Ref Sigmax.Sigma
, sigmaRef :: R.Ref Sigmax.Sigma
...
@@ -67,7 +71,8 @@ type CameraButtonProps = (
...
@@ -67,7 +71,8 @@ type CameraButtonProps = (
cameraButton :: Record CameraButtonProps -> R.Element
cameraButton :: Record CameraButtonProps -> R.Element
cameraButton { id
cameraButton { asyncTasksRef
, id
, hyperdataGraph: GET.HyperdataGraph { graph: GET.GraphData hyperdataGraph }
, hyperdataGraph: GET.HyperdataGraph { graph: GET.GraphData hyperdataGraph }
, session
, session
, sigmaRef
, sigmaRef
...
@@ -102,8 +107,12 @@ cameraButton { id
...
@@ -102,8 +107,12 @@ cameraButton { id
, mCamera: Just camera }
, mCamera: Just camera }
launchAff_ $ do
launchAff_ $ do
clonedGraphId <- cloneGraph { id, hyperdataGraph, session }
clonedGraphId <- cloneGraph { id, hyperdataGraph, session }
ret <- uploadArbitraryDataURL session clonedGraphId (Just $ nowStr <> "-" <> "screenshot.png") screen
task <- uploadArbitraryDataURL session clonedGraphId (Just $ nowStr <> "-" <> "screenshot.png") screen
liftEffect $ treeReload unit
case R.readRef asyncTasksRef of
pure ret
Nothing -> pure unit
Just asyncTasks -> liftEffect $ do
snd asyncTasks $ GAT.Insert id task
treeReload unit
pure task
, text: "Screenshot"
, text: "Screenshot"
}
}
src/Gargantext/Components/GraphExplorer/Controls.purs
View file @
c03222b2
...
@@ -20,6 +20,7 @@ import Prelude
...
@@ -20,6 +20,7 @@ import Prelude
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as RH
import Reactix.DOM.HTML as RH
import Gargantext.AsyncTasks as GAT
import Gargantext.Components.Graph as Graph
import Gargantext.Components.Graph as Graph
import Gargantext.Components.GraphExplorer.Button (centerButton, cameraButton)
import Gargantext.Components.GraphExplorer.Button (centerButton, cameraButton)
import Gargantext.Components.GraphExplorer.RangeControl (edgeConfluenceControl, edgeWeightControl, nodeSizeControl)
import Gargantext.Components.GraphExplorer.RangeControl (edgeConfluenceControl, edgeWeightControl, nodeSizeControl)
...
@@ -35,7 +36,8 @@ thisModule :: String
...
@@ -35,7 +36,8 @@ thisModule :: String
thisModule = "Gargantext.Components.GraphExplorer.Controls"
thisModule = "Gargantext.Components.GraphExplorer.Controls"
type Controls =
type Controls =
( edgeConfluence :: R.State Range.NumberRange
( asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, edgeConfluence :: R.State Range.NumberRange
, edgeWeight :: R.State Range.NumberRange
, edgeWeight :: R.State Range.NumberRange
, forceAtlasState :: R.State SigmaxT.ForceAtlasState
, forceAtlasState :: R.State SigmaxT.ForceAtlasState
, graph :: SigmaxT.SGraph
, graph :: SigmaxT.SGraph
...
@@ -160,11 +162,12 @@ controlsCpt = R.hooksComponentWithModule thisModule "controls" cpt
...
@@ -160,11 +162,12 @@ controlsCpt = R.hooksComponentWithModule thisModule "controls" cpt
, RH.li { className: "nav-item" } [ multiSelectEnabledButton props.multiSelectEnabled ] -- toggle multi node selection
, RH.li { className: "nav-item" } [ multiSelectEnabledButton props.multiSelectEnabled ] -- toggle multi node selection
-- save button
-- save button
, RH.li { className: "nav-item" } [ mouseSelectorSizeButton props.sigmaRef localControls.mouseSelectorSize ]
, RH.li { className: "nav-item" } [ mouseSelectorSizeButton props.sigmaRef localControls.mouseSelectorSize ]
, RH.li { className: "nav-item" } [ cameraButton { id: props.graphId
, RH.li { className: "nav-item" } [ cameraButton { asyncTasksRef: props.asyncTasksRef
, hyperdataGraph: props.hyperdataGraph
, id: props.graphId
, session: props.session
, hyperdataGraph: props.hyperdataGraph
, sigmaRef: props.sigmaRef
, session: props.session
, treeReload: props.treeReload } ]
, sigmaRef: props.sigmaRef
, treeReload: props.treeReload } ]
]
]
]
]
-- RH.ul {} [ -- change type button (?)
-- RH.ul {} [ -- change type button (?)
...
@@ -196,14 +199,16 @@ controlsCpt = R.hooksComponentWithModule thisModule "controls" cpt
...
@@ -196,14 +199,16 @@ controlsCpt = R.hooksComponentWithModule thisModule "controls" cpt
-- ]
-- ]
-- ]
-- ]
useGraphControls :: { forceAtlasS :: SigmaxT.ForceAtlasState
useGraphControls :: { asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, forceAtlasS :: SigmaxT.ForceAtlasState
, graph :: SigmaxT.SGraph
, graph :: SigmaxT.SGraph
, graphId :: GET.GraphId
, graphId :: GET.GraphId
, hyperdataGraph :: GET.HyperdataGraph
, hyperdataGraph :: GET.HyperdataGraph
, session :: Session
, session :: Session
, treeReload :: Unit -> Effect Unit }
, treeReload :: Unit -> Effect Unit }
-> R.Hooks (Record Controls)
-> R.Hooks (Record Controls)
useGraphControls { forceAtlasS
useGraphControls { asyncTasksRef
, forceAtlasS
, graph
, graph
, graphId
, graphId
, hyperdataGraph
, hyperdataGraph
...
@@ -228,7 +233,8 @@ useGraphControls { forceAtlasS
...
@@ -228,7 +233,8 @@ useGraphControls { forceAtlasS
sigma <- Sigmax.initSigma
sigma <- Sigmax.initSigma
sigmaRef <- R.useRef sigma
sigmaRef <- R.useRef sigma
pure { edgeConfluence
pure { asyncTasksRef
, edgeConfluence
, edgeWeight
, edgeWeight
, forceAtlasState
, forceAtlasState
, graph
, graph
...
...
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