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
graphVersionRef <- R.useRef (GUR.value graphVersion)
treeReload <- GUR.new
treeReloadRef <- GUR.newIInitialized treeReload
controls <- Controls.useGraphControls { forceAtlasS
controls <- Controls.useGraphControls { asyncTasksRef
, forceAtlasS
, graph
, graphId
, hyperdataGraph
...
...
src/Gargantext/Components/GraphExplorer/Button.purs
View file @
c03222b2
...
...
@@ -7,11 +7,12 @@ module Gargantext.Components.GraphExplorer.Button
import Prelude
import Data.Enum (fromEnum)
import Data.Maybe (Maybe(..))
import Data.DateTime as DDT
import Data.DateTime.Instant as DDI
import Data.Enum (fromEnum)
import Data.Maybe (Maybe(..))
import Data.String as DS
import Data.Tuple (snd)
import DOM.Simple.Console (log2)
import Effect (Effect)
import Effect.Aff (launchAff_)
...
...
@@ -20,6 +21,7 @@ import Effect.Now as EN
import Reactix as R
import Reactix.DOM.HTML as H
import Gargantext.AsyncTasks as GAT
import Gargantext.Components.Forest.Tree.Node.Action.Upload (uploadArbitraryDataURL)
import Gargantext.Components.GraphExplorer.API (cloneGraph)
import Gargantext.Components.GraphExplorer.Types as GET
...
...
@@ -29,6 +31,7 @@ import Gargantext.Hooks.Sigmax.Sigma as Sigma
import Gargantext.Sessions (Session)
import Gargantext.Utils.Reactix as R2
thisModule :: String
thisModule = "Gargantext.Components.GraphExplorer.Button"
type Props = (
...
...
@@ -58,7 +61,8 @@ centerButton sigmaRef = simpleButton {
type CameraButtonProps = (
id :: Int
asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, id :: Int
, hyperdataGraph :: GET.HyperdataGraph
, session :: Session
, sigmaRef :: R.Ref Sigmax.Sigma
...
...
@@ -67,7 +71,8 @@ type CameraButtonProps = (
cameraButton :: Record CameraButtonProps -> R.Element
cameraButton { id
cameraButton { asyncTasksRef
, id
, hyperdataGraph: GET.HyperdataGraph { graph: GET.GraphData hyperdataGraph }
, session
, sigmaRef
...
...
@@ -102,8 +107,12 @@ cameraButton { id
, mCamera: Just camera }
launchAff_ $ do
clonedGraphId <- cloneGraph { id, hyperdataGraph, session }
ret <- uploadArbitraryDataURL session clonedGraphId (Just $ nowStr <> "-" <> "screenshot.png") screen
liftEffect $ treeReload unit
pure ret
task <- uploadArbitraryDataURL session clonedGraphId (Just $ nowStr <> "-" <> "screenshot.png") screen
case R.readRef asyncTasksRef of
Nothing -> pure unit
Just asyncTasks -> liftEffect $ do
snd asyncTasks $ GAT.Insert id task
treeReload unit
pure task
, text: "Screenshot"
}
src/Gargantext/Components/GraphExplorer/Controls.purs
View file @
c03222b2
...
...
@@ -20,6 +20,7 @@ import Prelude
import Reactix as R
import Reactix.DOM.HTML as RH
import Gargantext.AsyncTasks as GAT
import Gargantext.Components.Graph as Graph
import Gargantext.Components.GraphExplorer.Button (centerButton, cameraButton)
import Gargantext.Components.GraphExplorer.RangeControl (edgeConfluenceControl, edgeWeightControl, nodeSizeControl)
...
...
@@ -35,7 +36,8 @@ thisModule :: String
thisModule = "Gargantext.Components.GraphExplorer.Controls"
type Controls =
( edgeConfluence :: R.State Range.NumberRange
( asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, edgeConfluence :: R.State Range.NumberRange
, edgeWeight :: R.State Range.NumberRange
, forceAtlasState :: R.State SigmaxT.ForceAtlasState
, graph :: SigmaxT.SGraph
...
...
@@ -160,11 +162,12 @@ controlsCpt = R.hooksComponentWithModule thisModule "controls" cpt
, RH.li { className: "nav-item" } [ multiSelectEnabledButton props.multiSelectEnabled ] -- toggle multi node selection
-- save button
, RH.li { className: "nav-item" } [ mouseSelectorSizeButton props.sigmaRef localControls.mouseSelectorSize ]
, RH.li { className: "nav-item" } [ cameraButton { id: props.graphId
, hyperdataGraph: props.hyperdataGraph
, session: props.session
, sigmaRef: props.sigmaRef
, treeReload: props.treeReload } ]
, RH.li { className: "nav-item" } [ cameraButton { asyncTasksRef: props.asyncTasksRef
, id: props.graphId
, hyperdataGraph: props.hyperdataGraph
, session: props.session
, sigmaRef: props.sigmaRef
, treeReload: props.treeReload } ]
]
]
-- RH.ul {} [ -- change type button (?)
...
...
@@ -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
, graphId :: GET.GraphId
, hyperdataGraph :: GET.HyperdataGraph
, session :: Session
, treeReload :: Unit -> Effect Unit }
-> R.Hooks (Record Controls)
useGraphControls { forceAtlasS
useGraphControls { asyncTasksRef
, forceAtlasS
, graph
, graphId
, hyperdataGraph
...
...
@@ -228,7 +233,8 @@ useGraphControls { forceAtlasS
sigma <- Sigmax.initSigma
sigmaRef <- R.useRef sigma
pure { edgeConfluence
pure { asyncTasksRef
, edgeConfluence
, edgeWeight
, forceAtlasState
, 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