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
9d337e6b
Commit
9d337e6b
authored
May 16, 2024
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/643-export-the-phylo-in-json-and-dot-format' into dev
parents
be175b01
8e79e206
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
0 deletions
+47
-0
Download.purs
...rgantext/Components/Forest/Tree/Node/Action/Download.purs
+46
-0
Settings.purs
src/Gargantext/Components/Forest/Tree/Node/Settings.purs
+1
-0
No files found.
src/Gargantext/Components/Forest/Tree/Node/Action/Download.purs
View file @
9d337e6b
...
...
@@ -34,6 +34,7 @@ actionDownloadCpt = here.component "actionDownload" cpt where
cpt props@{ nodeType: GT.Graph } _ = pure $ actionDownloadGraph props []
cpt props@{ nodeType: GT.NodeList } _ = pure $ actionDownloadNodeList props []
cpt props@{ nodeType: GT.NodeTexts } _ = pure $ actionDownloadNodeTexts props []
cpt props@{ nodeType: GT.Phylo } _ = pure $ actionDownloadPhylo props []
cpt props@{ nodeType: _ } _ = pure $ actionDownloadOther props []
actionDownloadCorpus :: R2.Component ActionDownload
...
...
@@ -156,6 +157,51 @@ actionDownloadNodeTextsCpt = here.component "actionDownloadNodeTexts" cpt where
info :: NodeTextsDownloadFormat -> String
info t = "Info about the Documents as " <> show t <> " format"
data PhyloDownloadFormat = PH_JSON | PH_DOT
derive instance Eq PhyloDownloadFormat
derive instance Generic PhyloDownloadFormat _
instance Show PhyloDownloadFormat where
show PH_JSON = "JSON"
show PH_DOT = "DOT"
urlPhyloDownloadFormat :: PhyloDownloadFormat -> String
urlPhyloDownloadFormat PH_JSON = "json"
urlPhyloDownloadFormat PH_DOT = "dot"
readPhyloDownloadFormat :: String -> PhyloDownloadFormat
readPhyloDownloadFormat "JSON" = PH_JSON
readPhyloDownloadFormat "DOT" = PH_DOT
readPhyloDownloadFormat _ = PH_DOT
actionDownloadPhylo :: R2.Component ActionDownload
actionDownloadPhylo = R.createElement actionDownloadPhyloCpt
actionDownloadPhyloCpt :: R.Component ActionDownload
actionDownloadPhyloCpt = here.component "actionDownloadPhylo" cpt where
cpt { id, session } _ = do
downloadFormat <- T.useBox PH_DOT
downloadFormat' <- T.useLive T.unequal downloadFormat
pure $ Tools.panelWithSubmitButtonHref { action: DownloadNode
, href: href downloadFormat'
, mError: Nothing }
[ R2.select { className: "form-control"
, defaultValue: show downloadFormat'
, on: { change: onChange downloadFormat } }
[ opt PH_JSON
, opt PH_DOT
]
, H.div {} [ H.text $ info downloadFormat' ]
]
where
opt t = H.option { value: show t } [ H.text $ show t ]
onChange downloadFormat e = T.write_ (readPhyloDownloadFormat $ R.unsafeEventValue e) downloadFormat
href :: PhyloDownloadFormat -> String
href t = url session $ Routes.NodeAPI GT.Phylo (Just id) ("export/" <> urlPhyloDownloadFormat t)
info :: PhyloDownloadFormat -> String
info t = "Info about the Phylo as " <> show t <> " format"
{-
-- TODO fix the route
actionDownload GT.Texts id session = pure $ panel [H.div {} [H.text info]]
...
...
src/Gargantext/Components/Forest/Tree/Node/Settings.purs
View file @
9d337e6b
...
...
@@ -288,6 +288,7 @@ settingsBoxLens Notes =
]
settingsBoxLens Phylo =
_buttons .~ [ Reconstruct
, Download
, ShareURL
, Delete
]
...
...
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