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
143
Issues
143
List
Board
Labels
Milestones
Merge Requests
8
Merge Requests
8
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
cf9f8322
Verified
Commit
cf9f8322
authored
Feb 21, 2025
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[corpus] add download option, in JSON and SQLite
Related to
haskell-gargantext#362
parent
2e43c474
Pipeline
#7333
passed with stages
in 23 minutes and 22 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
4 deletions
+40
-4
Download.purs
...rgantext/Components/Forest/Tree/Node/Action/Download.purs
+39
-3
Settings.purs
src/Gargantext/Components/Forest/Tree/Node/Settings.purs
+1
-1
No files found.
src/Gargantext/Components/Forest/Tree/Node/Action/Download.purs
View file @
cf9f8322
...
@@ -39,6 +39,24 @@ actionDownloadCpt = here.component "actionDownload" cpt
...
@@ -39,6 +39,24 @@ actionDownloadCpt = here.component "actionDownload" cpt
cpt props@{ nodeType: GT.Phylo } _ = pure $ actionDownloadPhylo props []
cpt props@{ nodeType: GT.Phylo } _ = pure $ actionDownloadPhylo props []
cpt props@{ nodeType: _ } _ = pure $ actionDownloadOther props []
cpt props@{ nodeType: _ } _ = pure $ actionDownloadOther props []
data CorpusDownloadFormat = CD_SQLITE | CD_JSON
derive instance Eq CorpusDownloadFormat
derive instance Generic CorpusDownloadFormat _
instance Show CorpusDownloadFormat
where
show CD_JSON = "JSON"
show CD_SQLITE = "SQLite"
urlCorpusDownloadFormat :: CorpusDownloadFormat -> String
urlCorpusDownloadFormat CD_JSON = "export"
urlCorpusDownloadFormat CD_SQLITE = "sqlite"
readCorpusDownloadFormat :: String -> CorpusDownloadFormat
readCorpusDownloadFormat "JSON" = CD_JSON
readCorpusDownloadFormat "SQLite" = CD_SQLITE
readCorpusDownloadFormat _ = CD_SQLITE
actionDownloadCorpus :: R2.Component ActionDownload
actionDownloadCorpus :: R2.Component ActionDownload
actionDownloadCorpus = R.createElement actionDownloadCorpusCpt
actionDownloadCorpus = R.createElement actionDownloadCorpusCpt
...
@@ -46,17 +64,35 @@ actionDownloadCorpusCpt :: R.Component ActionDownload
...
@@ -46,17 +64,35 @@ actionDownloadCorpusCpt :: R.Component ActionDownload
actionDownloadCorpusCpt = here.component "actionDownloadCorpus" cpt
actionDownloadCorpusCpt = here.component "actionDownloadCorpus" cpt
where
where
cpt { id, session } _ = do
cpt { id, session } _ = do
downloadFormat <- T.useBox CD_SQLITE
downloadFormat' <- T.useLive T.unequal downloadFormat
pure $
pure $
Tools.panelWithSubmitButtonHref
Tools.panelWithSubmitButtonHref
{ action: DownloadNode
{ action: DownloadNode
, href
, href
: href downloadFormat'
, mError: Nothing
, mError: Nothing
, iconName: "download"
, iconName: "download"
, textTitle: "Download the corpus"
, textTitle: "Download the corpus"
}
}
[ H.div {} [ H.text "Download as JSON" ] ]
[ R2.select
{ className: "form-control"
, defaultValue: show downloadFormat'
, on: { change: onChange downloadFormat }
}
[ opt CD_SQLITE
, opt CD_JSON
]
, H.div {} [ H.text $ info downloadFormat' ]
]
where
where
href = url session $ Routes.NodeAPI GT.Corpus (Just id) "export"
opt t = H.option { value: show t } [ H.text $ show t ]
onChange downloadFormat e = T.write_ (readCorpusDownloadFormat $ R.unsafeEventValue e) downloadFormat
href t = url session $ Routes.NodeAPI GT.Corpus (Just id) (urlCorpusDownloadFormat t)
info :: CorpusDownloadFormat -> String
info t = "Download corpus in " <> show t <> " format"
actionDownloadGraph :: R2.Component ActionDownload
actionDownloadGraph :: R2.Component ActionDownload
actionDownloadGraph = R.createElement actionDownloadGraphCpt
actionDownloadGraph = R.createElement actionDownloadGraphCpt
...
...
src/Gargantext/Components/Forest/Tree/Node/Settings.purs
View file @
cf9f8322
...
@@ -175,11 +175,11 @@ settingsBoxLens Corpus =
...
@@ -175,11 +175,11 @@ settingsBoxLens Corpus =
, Calc
, Calc
]
]
, Upload
, Upload
, Download
, SearchBox
, SearchBox
, WriteNodesDocuments
, WriteNodesDocuments
-- , ReloadWithSettings -- TODO
-- , ReloadWithSettings -- TODO
, Move moveParameters
, Move moveParameters
-- , Download
-- , Link (linkParams Annuaire)
-- , Link (linkParams Annuaire)
, ShareURL
, ShareURL
, Delete
, 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