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
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Grégoire Locqueville
purescript-gargantext
Commits
9ee9bf21
Commit
9ee9bf21
authored
Jan 12, 2022
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '339-dev-corpus-download' into 339-dev-docs-download
parents
60ad658d
39a68fe8
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
13 deletions
+38
-13
DocsTable.purs
src/Gargantext/Components/DocsTable.purs
+3
-3
Download.purs
...rgantext/Components/Forest/Tree/Node/Action/Download.purs
+35
-9
Score.purs
src/Gargantext/Components/Score.purs
+0
-1
No files found.
src/Gargantext/Components/DocsTable.purs
View file @
9ee9bf21
...
@@ -439,9 +439,9 @@ pageLayoutCpt = here.component "pageLayout" cpt where
...
@@ -439,9 +439,9 @@ pageLayoutCpt = here.component "pageLayout" cpt where
let loader p = do
let loader p = do
let route = tableRouteWithPage (p { params = paramsS', query = query })
let route = tableRouteWithPage (p { params = paramsS', query = query })
eRes <- get session $ route
eRes <- get session $ route
liftEffect $ do
--
liftEffect $ do
here.log2 "table route" route
--
here.log2 "table route" route
here.log2 "table res" eRes
--
here.log2 "table res" eRes
pure $ handleResponse <$> eRes
pure $ handleResponse <$> eRes
let render (Tuple count documents) = pagePaintRaw { documents
let render (Tuple count documents) = pagePaintRaw { documents
, layout: props { params = paramsS'
, layout: props { params = paramsS'
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Download.purs
View file @
9ee9bf21
module Gargantext.Components.Forest.Tree.Node.Action.Download where
module Gargantext.Components.Forest.Tree.Node.Action.Download where
import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Reactix as R
import Data.Show.Generic (genericShow)
import Reactix.DOM.HTML as H
import Data.String.Common (toLower)
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(DownloadNode))
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(DownloadNode))
import Gargantext.Components.Forest.Tree.Node.Tools (fragmentPT, panel, submitButtonHref)
import Gargantext.Components.Forest.Tree.Node.Tools (fragmentPT, panel, submitButtonHref)
import Gargantext.Ends (url)
import Gargantext.Ends (url)
import Gargantext.Prelude
(pure, ($))
import Gargantext.Prelude
import Gargantext.Routes as Routes
import Gargantext.Routes as Routes
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
import Gargantext.Types (ID)
import Gargantext.Types (ID)
import Gargantext.Types as GT
import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Download"
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Download"
...
@@ -66,17 +69,40 @@ actionDownloadNodeListCpt = here.component "actionDownloadNodeList" cpt where
...
@@ -66,17 +69,40 @@ actionDownloadNodeListCpt = here.component "actionDownloadNodeList" cpt where
href = url session $ Routes.NodeAPI GT.NodeList (Just id) ""
href = url session $ Routes.NodeAPI GT.NodeList (Just id) ""
info = "Info about the List as JSON format"
info = "Info about the List as JSON format"
data NodeTextsDownloadFormat = CSV | JSON
derive instance Eq NodeTextsDownloadFormat
derive instance Generic NodeTextsDownloadFormat _
instance Show NodeTextsDownloadFormat where show = genericShow
readDownloadFormat :: String -> NodeTextsDownloadFormat
readDownloadFormat "CSV" = CSV
readDownloadFormat "JSON" = JSON
readDownloadFormat _ = JSON
actionDownloadNodeTexts :: R2.Component ActionDownload
actionDownloadNodeTexts :: R2.Component ActionDownload
actionDownloadNodeTexts = R.createElement actionDownloadNodeTextsCpt
actionDownloadNodeTexts = R.createElement actionDownloadNodeTextsCpt
actionDownloadNodeTextsCpt :: R.Component ActionDownload
actionDownloadNodeTextsCpt :: R.Component ActionDownload
actionDownloadNodeTextsCpt = here.component "actionDownloadNodeTexts" cpt where
actionDownloadNodeTextsCpt = here.component "actionDownloadNodeTexts" cpt where
cpt { id, session } _ = do
cpt { id, session } _ = do
pure $ panel [H.div {} [H.text info]]
downloadFormat <- T.useBox JSON
(submitButtonHref DownloadNode href)
downloadFormat' <- T.useLive T.unequal downloadFormat
where
href = url session $ Routes.NodeAPI GT.NodeTexts (Just id) "export"
info = "Download as JSON"
pure $ panel
[ R2.select { className: "form-control"
, defaultValue: show downloadFormat'
, on: { change: onChange downloadFormat } }
[ opt CSV downloadFormat
, opt JSON downloadFormat ]
, H.div {} [ H.text $ info downloadFormat' ]
]
(submitButtonHref DownloadNode $ href downloadFormat')
where
opt t downloadFormat = H.option { value: show t } [ H.text $ show t ]
where
onClick _ = T.write_ t downloadFormat
onChange downloadFormat e = T.write_ (readDownloadFormat $ R.unsafeEventValue e) downloadFormat
href t = url session $ Routes.NodeAPI GT.NodeTexts (Just id) ("export/" <> (toLower $ show t))
info t = "Info about the Documents as " <> show t <> " format"
{-
{-
-- TODO fix the route
-- TODO fix the route
...
...
src/Gargantext/Components/Score.purs
View file @
9ee9bf21
...
@@ -36,7 +36,6 @@ type Choice = Maybe Score
...
@@ -36,7 +36,6 @@ type Choice = Maybe Score
scoreEl :: R2.Component Props
scoreEl :: R2.Component Props
scoreEl = R.createElement scoreElCpt
scoreEl = R.createElement scoreElCpt
scoreElCpt :: R.Component Props
scoreElCpt :: R.Component Props
scoreElCpt = R.hooksComponentWithModule thisModule "scoreEl" cpt
scoreElCpt = R.hooksComponentWithModule thisModule "scoreEl" cpt
where
where
...
...
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