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
131
Issues
131
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
3f3693fb
Commit
3f3693fb
authored
2 years ago
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[toolbar] camera: simpler and more reliable screenshot filename gen
parent
09a5846c
Pipeline
#3313
canceled with stage
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
51 deletions
+47
-51
spago.dhall
spago.dhall
+1
-3
Buttons.purs
src/Gargantext/Components/GraphExplorer/Toolbar/Buttons.purs
+45
-47
Controls.purs
...Gargantext/Components/GraphExplorer/Toolbar/Controls.purs
+1
-1
No files found.
spago.dhall
View file @
3f3693fb
...
@@ -40,6 +40,7 @@ to generate this file without the comments in this block.
...
@@ -40,6 +40,7 @@ to generate this file without the comments in this block.
, "foreign"
, "foreign"
, "foreign-object"
, "foreign-object"
, "form-urlencoded"
, "form-urlencoded"
, "formatters"
, "formula"
, "formula"
, "functions"
, "functions"
, "graphql-client"
, "graphql-client"
...
@@ -47,9 +48,7 @@ to generate this file without the comments in this block.
...
@@ -47,9 +48,7 @@ to generate this file without the comments in this block.
, "integers"
, "integers"
, "js-timers"
, "js-timers"
, "lists"
, "lists"
-- , "markdown"
, "markdown-it"
, "markdown-it"
--, "markdown-smolder"
, "maybe"
, "maybe"
, "media-types"
, "media-types"
, "milkis"
, "milkis"
...
@@ -75,7 +74,6 @@ to generate this file without the comments in this block.
...
@@ -75,7 +74,6 @@ to generate this file without the comments in this block.
, "simple-json"
, "simple-json"
, "simple-json-generics"
, "simple-json-generics"
, "simplecrypto"
, "simplecrypto"
-- , "smolder"
, "strings"
, "strings"
, "strings-extra"
, "strings-extra"
, "stringutils"
, "stringutils"
...
...
This diff is collapsed.
Click to expand it.
src/Gargantext/Components/GraphExplorer/Toolbar/Buttons.purs
View file @
3f3693fb
...
@@ -11,15 +11,13 @@ module Gargantext.Components.GraphExplorer.Toolbar.Buttons
...
@@ -11,15 +11,13 @@ module Gargantext.Components.GraphExplorer.Toolbar.Buttons
import Prelude
import Prelude
import Data.Array as A
import Data.Array as A
import Data.DateTime as DDT
import Data.DateTime.Instant as DDI
import Data.Either (Either(..))
import Data.Either (Either(..))
import Data.
Enum (fromEnum)
import Data.
Formatter.DateTime as DFDT
import Data.Foldable (intercalate)
import Data.Foldable (intercalate)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Sequence as Seq
import Data.Sequence as Seq
import Data.String as DS
import DOM.Simple.Console (log2)
import DOM.Simple.Console (log2)
import Effect (Effect)
import Effect.Aff (launchAff_)
import Effect.Aff (launchAff_)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Effect.Now as EN
import Effect.Now as EN
...
@@ -64,53 +62,53 @@ centerButton sigmaRef = B.button
...
@@ -64,53 +62,53 @@ centerButton sigmaRef = B.button
type CameraButtonProps =
type CameraButtonProps =
( id :: Int
( id :: Int
, hyperdataGraph :: GET.HyperdataGraph
, hyperdataGraph :: GET.HyperdataGraph
, reloadForest :: T2.ReloadS
, session :: Session
, session :: Session
, sigmaRef :: R.Ref Sigmax.Sigma
, sigmaRef :: R.Ref Sigmax.Sigma
, reloadForest :: T2.ReloadS
)
)
screenshotFilename :: Effect String
cameraButton :: Record CameraButtonProps -> R.Element
screenshotFilename = do
cameraButton { id
nowdt <- EN.nowDateTime
, hyperdataGraph: GET.HyperdataGraph { graph: GET.GraphData hyperdataGraph }
pure $ case DFDT.formatDateTime "YYYY-MM-DDTHH:mm:ss" nowdt of
, session
Left err -> err
, sigmaRef
Right s -> s <> "-screenshot.png"
, reloadForest } = B.button
cameraButton :: R2.Leaf CameraButtonProps
{ variant: OutlinedButtonVariant Secondary
cameraButton = R2.leaf cameraButtonCpt
, callback: \_ -> do
cameraButtonCpt :: R.Component CameraButtonProps
let sigma = R.readRef sigmaRef
cameraButtonCpt = here.component "cameraButton" cpt
Sigmax.dependOnSigma sigma "[cameraButton] sigma: Nothing" $ \s -> do
where
screen <- Sigma.takeScreenshot s
cpt { id
now <- EN.now
, hyperdataGraph: GET.HyperdataGraph { graph: GET.GraphData hyperdataGraph }
let nowdt = DDI.toDateTime now
, reloadForest
nowd = DDT.date nowdt
, session
nowt = DDT.time nowdt
, sigmaRef } _ = do
nowStr = DS.joinWith "-" [ show $ fromEnum $ DDT.year nowd
pure $ B.button
, show $ fromEnum $ DDT.month nowd
{ callback: \_ -> do
, show $ fromEnum $ DDT.day nowd
filename <- screenshotFilename
, show $ fromEnum $ DDT.hour nowt
let sigma = R.readRef sigmaRef
, show $ fromEnum $ DDT.minute nowt
Sigmax.dependOnSigma sigma "[cameraButton] sigma: Nothing" $ \s -> do
, show $ fromEnum $ DDT.second nowt ]
screen <- Sigma.takeScreenshot s
let graph = Sigma.graph s
let graph = Sigma.graph s
edges = Graphology.edges graph
edges = Graphology.edges graph
nodes = Graphology.nodes graph
nodes = Graphology.nodes graph
graphData = GET.GraphData $ hyperdataGraph { edges = A.fromFoldable $ Seq.map GEU.stEdgeToGET edges
graphData = GET.GraphData $ hyperdataGraph { edges = A.fromFoldable $ Seq.map GEU.stEdgeToGET edges
, nodes = A.fromFoldable $ GEU.normalizeNodes $ Seq.map GEU.stNodeToGET nodes }
, nodes = A.fromFoldable $ GEU.normalizeNodes $ Seq.map GEU.stNodeToGET nodes }
let camera = Camera.toCamera $ Camera.camera s
let camera = Camera.toCamera $ Camera.camera s
let hyperdataGraph' = GET.HyperdataGraph { graph: graphData, mCamera: Just camera }
let hyperdataGraph' = GET.HyperdataGraph { graph: graphData, mCamera: Just camera }
launchAff_ $ do
launchAff_ $ do
eClonedGraphId <- cloneGraph { id, hyperdataGraph: hyperdataGraph', session }
eClonedGraphId <- cloneGraph { id, hyperdataGraph: hyperdataGraph', session }
case eClonedGraphId of
case eClonedGraphId of
Left err -> liftEffect $ log2 "[cameraButton] RESTError" err
Left err -> liftEffect $ log2 "[cameraButton] RESTError" err
Right clonedGraphId -> do
Right clonedGraphId -> do
eRet <- uploadArbitraryData session clonedGraphId Plain (Just $ nowStr <> "-" <> "screenshot.png"
) screen
eRet <- uploadArbitraryData session clonedGraphId Plain (Just filename
) screen
case eRet of
case eRet of
Left err -> liftEffect $ log2 "[cameraButton] RESTError" err
Left err -> liftEffect $ log2 "[cameraButton] RESTError" err
Right _ret -> do
Right _ret -> do
liftEffect $ T2.reload reloadForest
liftEffect $ T2.reload reloadForest
}
, variant: OutlinedButtonVariant Secondary
[ H.text "Screenshot" ]
}
[ H.text "Screenshot" ]
------------------------------------------------------
------------------------------------------------------
...
...
This diff is collapsed.
Click to expand it.
src/Gargantext/Components/GraphExplorer/Toolbar/Controls.purs
View file @
3f3693fb
...
@@ -185,9 +185,9 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
...
@@ -185,9 +185,9 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
cameraButton
cameraButton
{ id: graphId'
{ id: graphId'
, hyperdataGraph: hyperdataGraph'
, hyperdataGraph: hyperdataGraph'
, reloadForest
, session: session
, session: session
, sigmaRef: sigmaRef
, sigmaRef: sigmaRef
, reloadForest
}
}
]
]
,
,
...
...
This diff is collapsed.
Click to expand it.
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