Commit f2ac5e36 authored by Alexandre Delanoë's avatar Alexandre Delanoë

MERGE fix

parents b1df3481 898b94d1
......@@ -151,7 +151,7 @@ nodeSpanCpt = here.component "nodeSpan" cpt
liftEffect $ do
T.write_ (Just
$ DroppedFile { blob: (UploadFileBlob blob)
, fileType: Just CSV
, fileType: Just TSV
, lang : EN
}) droppedFile
......
......@@ -63,22 +63,22 @@ actionDownloadGraphCpt = here.component "actionDownloadGraph" cpt where
where
href = url session $ Routes.NodeAPI GT.Graph (Just id) "gexf"
data NodeListDownloadFormat = NL_CSV | NL_JSON | NL_JSON_ZIP
data NodeListDownloadFormat = NL_TSV | NL_JSON | NL_JSON_ZIP
derive instance Eq NodeListDownloadFormat
derive instance Generic NodeListDownloadFormat _
instance Show NodeListDownloadFormat
where
show NL_CSV = "CSV"
show NL_TSV = "TSV"
show NL_JSON = "JSON"
show NL_JSON_ZIP = "JSON (zipped)"
urlNodeListDownloadFormat :: NodeListDownloadFormat -> String
urlNodeListDownloadFormat NL_CSV = "csv"
urlNodeListDownloadFormat NL_TSV = "tsv"
urlNodeListDownloadFormat NL_JSON = "json"
urlNodeListDownloadFormat NL_JSON_ZIP = "json.zip"
readNodeListDownloadFormat :: String -> NodeListDownloadFormat
readNodeListDownloadFormat "CSV" = NL_CSV
readNodeListDownloadFormat "TSV" = NL_TSV
readNodeListDownloadFormat "JSON" = NL_JSON
readNodeListDownloadFormat "JSON (zipped)" = NL_JSON_ZIP
readNodeListDownloadFormat _ = NL_JSON
......@@ -110,21 +110,21 @@ actionDownloadNodeListCpt = here.component "actionDownloadNodeList" cpt where
info :: NodeListDownloadFormat -> String
info t = "Info about the Documents as " <> show t <> " format"
data NodeTextsDownloadFormat = NT_CSV | NT_JSON | NT_JSON_ZIP
data NodeTextsDownloadFormat = NT_TSV | NT_JSON | NT_JSON_ZIP
derive instance Eq NodeTextsDownloadFormat
derive instance Generic NodeTextsDownloadFormat _
instance Show NodeTextsDownloadFormat where
show NT_CSV = "CSV"
show NT_TSV = "TSV"
show NT_JSON = "JSON"
show NT_JSON_ZIP = "JSON (zipped)"
urlNodeTextsDownloadFormat :: NodeTextsDownloadFormat -> String
urlNodeTextsDownloadFormat NT_CSV = "csv"
urlNodeTextsDownloadFormat NT_TSV = "tsv"
urlNodeTextsDownloadFormat NT_JSON = "json"
urlNodeTextsDownloadFormat NT_JSON_ZIP = "json.zip"
readNodeTextsDownloadFormat :: String -> NodeTextsDownloadFormat
readNodeTextsDownloadFormat "CSV" = NT_CSV
readNodeTextsDownloadFormat "TSV" = NT_TSV
readNodeTextsDownloadFormat "JSON" = NT_JSON
readNodeTextsDownloadFormat "JSON (zippped)" = NT_JSON_ZIP
readNodeTextsDownloadFormat _ = NT_JSON_ZIP
......@@ -143,7 +143,7 @@ actionDownloadNodeTextsCpt = here.component "actionDownloadNodeTexts" cpt where
[ R2.select { className: "form-control"
, defaultValue: show downloadFormat'
, on: { change: onChange downloadFormat } }
[ opt NT_CSV
[ opt NT_TSV
, opt NT_JSON
, opt NT_JSON_ZIP ]
, H.div {} [ H.text $ info downloadFormat' ]
......
......@@ -126,7 +126,7 @@ uploadFileViewWithLangsCpt = here.component "uploadFileViewWithLangs" cpt
cpt { dispatch, langs, nodeType, session } _ = do
-- mFile :: R.State (Maybe UploadFile) <- R.useState' Nothing
mFile <- T.useBox (Nothing :: Maybe UploadFile)
fileType <- T.useBox CSV
fileType <- T.useBox TSV
fileFormat <- T.useBox Plain
lang <- T.useBox EN
selection <- T.useBox ListSelection.MyListsFirst
......@@ -149,14 +149,14 @@ uploadFileViewWithLangsCpt = here.component "uploadFileViewWithLangs" cpt
]
, R2.row
[ H.div {className:"col-6 flex-space-around"}
[ Tools.formChoiceSafe { items: [ CSV
, CSV_HAL
[ Tools.formChoiceSafe { items: [ TSV
, TSV_HAL
, Istex
, WOS
, JSON
-- , Iramuteq
]
, default: CSV
, default: TSV
, callback: setFileType'
, print: show } []
, Tools.formChoiceSafe { items: [ Plain
......@@ -288,7 +288,7 @@ uploadButtonCpt = here.component "uploadButton" cpt
dispatch $ UploadFile nodeType fileType' fileFormat' lang' (Just name) contents selection'
liftEffect $ do
T.write_ Nothing mFile
T.write_ CSV fileType
T.write_ TSV fileType
T.write_ Plain fileFormat
T.write_ EN lang
T.write_ false onPendingBox
......@@ -303,7 +303,7 @@ uploadListViewCpt = here.component "uploadListView" cpt where
mFile
<- T.useBox (Nothing :: Maybe UploadFile)
fileType
<- T.useBox CSV
<- T.useBox TSV
fileFormat /\ fileFormatBox
<- R2.useBox' Plain
lang /\ langBox
......@@ -356,14 +356,14 @@ uploadListViewCpt = here.component "uploadListView" cpt where
[
B.formSelect
{ callback: \_ -> pure unit
, value: show CSV
, value: show TSV
, status: Disabled
, className: "col-5"
}
[
H.option
{ value: show CSV }
[ H.text $ show CSV ]
{ value: show TSV }
[ H.text $ show TSV ]
]
,
B.formSelect'
......@@ -502,7 +502,7 @@ fileTypeViewCpt = here.component "fileTypeView" cpt
[ R2.select {className: "col-md-12 form-control"
, on: {change: onChange}
}
(map renderOption [CSV, CSV_HAL, WOS, Iramuteq])
(map renderOption [TSV, TSV_HAL, WOS, Iramuteq])
]
where
onChange e l =
......@@ -582,7 +582,7 @@ uploadFile { contents, fileFormat, lang, fileType, id, nodeType, mName, selectio
, Tuple "_wjf_filetype" (Just $ show fileType)
, Tuple "_wjf_name" mName
]
csvBodyParams = [ Tuple "_wtf_data" (Just contents)
tsvBodyParams = [ Tuple "_wtf_data" (Just contents)
, Tuple "_wtf_filetype" (Just $ show fileType)
, Tuple "_wtf_fileformat" (Just $ show fileFormat)
, Tuple "_wf_lang" (Just $ show lang)
......@@ -595,7 +595,7 @@ uploadFile { contents, fileFormat, lang, fileType, id, nodeType, mName, selectio
Annuaire -> GT.UploadFile /\ (GR.NodeAPI nodeType (Just id) "annuaire") /\ bodyParams
NodeList -> case fileType of
JSON -> GT.ListUpload /\ (GR.NodeAPI nodeType (Just id) $ GT.asyncTaskTypePath GT.ListUpload) /\ jsonBodyParams
CSV -> GT.ListCSVUpload /\ (GR.NodeAPI NodeList (Just id) $ GT.asyncTaskTypePath GT.ListCSVUpload) /\ csvBodyParams
TSV -> GT.ListCSVUpload /\ (GR.NodeAPI NodeList (Just id) $ GT.asyncTaskTypePath GT.ListCSVUpload) /\ tsvBodyParams
_ -> GT.UploadFile /\ (GR.NodeAPI nodeType (Just id) "") /\ bodyParams
_ -> GT.UploadFile /\ (GR.NodeAPI nodeType (Just id) "") /\ bodyParams
......@@ -649,7 +649,7 @@ uploadTermListViewCpt = here.component "uploadTermListView" cpt
let uploadTypeHtml = R2.select { className: "form-control"
, defaultValue: show defaultUploadType
, on: { change: onUploadTypeChange uploadType } } (opt <$> [ CSV, JSON ])
, on: { change: onUploadTypeChange uploadType } } (opt <$> [ TSV, JSON ])
let footer = H.div {} [ uploadTermButton { dispatch
, mFile
......@@ -753,7 +753,7 @@ uploadFrameCalcViewWithLangsCpt = here.component "uploadFrameCalcViewWithLangs"
H.div
{ className: "col-12 flex-space-around" }
[ H.h4 {}
[ H.text "This will upload current calc as Corpus CSV" ]
[ H.text "This will upload current calc as Corpus TSV" ]
]
,
-- Lang
......
......@@ -13,7 +13,7 @@ import Web.File.Blob (Blob, size)
import Web.File.FileReader.Aff (readAsArrayBuffer, readAsText)
data FileType = CSV | CSV_HAL | Istex | WOS | PresseRIS | Arbitrary | JSON | Iramuteq
data FileType = TSV | TSV_HAL | Istex | WOS | PresseRIS | Arbitrary | JSON | Iramuteq
derive instance Generic FileType _
instance Eq FileType where eq = genericEq
......@@ -21,8 +21,8 @@ instance Show FileType where show = genericShow
instance Read FileType where
read :: String -> Maybe FileType
read "Arbitrary" = Just Arbitrary
read "CSV" = Just CSV
read "CSV_HAL" = Just CSV_HAL
read "TSV" = Just TSV
read "TSV_HAL" = Just TSV_HAL
read "Istex" = Just Istex
read "PresseRIS" = Just PresseRIS
read "WOS" = Just WOS
......
......@@ -10,10 +10,10 @@ import Gargantext.Prelude
type Base = String
type NodeId = String
downloadCSV :: Base -> NodeId -> Aff (Either Error (Response String))
downloadCSV base nodeId = do
downloadTSV :: Base -> NodeId -> Aff (Either Error (Response String))
downloadTSV base nodeId = do
let req = defaultRequest
{ url = base <> "/" <> nodeId <> ".csv"
{ url = base <> "/" <> nodeId <> ".tsv"
, responseFormat = ResponseFormat.string
, method = Left GET }
request req
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment