From 27895371e77e4d57989c1231c5450b6cefdaf578 Mon Sep 17 00:00:00 2001 From: Przemek Kaminski <pk@intrepidus.pl> Date: Mon, 9 Jan 2023 14:58:54 +0100 Subject: [PATCH] [docs] fixes to CSV/JSON download of texts --- .../Components/Forest/Tree/Node/Action/Download.purs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Gargantext/Components/Forest/Tree/Node/Action/Download.purs b/src/Gargantext/Components/Forest/Tree/Node/Action/Download.purs index 3b8129d2..6f156c23 100644 --- a/src/Gargantext/Components/Forest/Tree/Node/Action/Download.purs +++ b/src/Gargantext/Components/Forest/Tree/Node/Action/Download.purs @@ -101,7 +101,13 @@ actionDownloadNodeListCpt = here.component "actionDownloadNodeList" cpt where data NodeTextsDownloadFormat = NT_CSV | NT_JSON derive instance Eq NodeTextsDownloadFormat derive instance Generic NodeTextsDownloadFormat _ -instance Show NodeTextsDownloadFormat where show = genericShow +instance Show NodeTextsDownloadFormat where + show NT_CSV = "CSV" + show NT_JSON = "JSON" + +urlNodeTextsDownloadFormat :: NodeTextsDownloadFormat -> String +urlNodeTextsDownloadFormat NT_CSV = "csv" +urlNodeTextsDownloadFormat NT_JSON = "json" readNodeTextsDownloadFormat :: String -> NodeTextsDownloadFormat readNodeTextsDownloadFormat "CSV" = NT_CSV @@ -131,7 +137,7 @@ actionDownloadNodeTextsCpt = here.component "actionDownloadNodeTexts" cpt where onClick _ = T.write_ t downloadFormat onChange downloadFormat e = T.write_ (readNodeTextsDownloadFormat $ R.unsafeEventValue e) downloadFormat href :: NodeTextsDownloadFormat -> String - href t = url session $ Routes.NodeAPI GT.NodeTexts (Just id) ("export/" <> (toLower $ show t)) + href t = url session $ Routes.NodeAPI GT.NodeTexts (Just id) ("export/" <> urlNodeTextsDownloadFormat t) info :: NodeTextsDownloadFormat -> String info t = "Info about the Documents as " <> show t <> " format" -- 2.21.0