Commit 2e02f0f5 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[upload] fix default upload type value

parent 494295c0
...@@ -375,8 +375,9 @@ uploadTermListViewCpt :: R.Component Props ...@@ -375,8 +375,9 @@ uploadTermListViewCpt :: R.Component Props
uploadTermListViewCpt = here.component "uploadTermListView" cpt uploadTermListViewCpt = here.component "uploadTermListView" cpt
where where
cpt {dispatch, id, nodeType} _ = do cpt {dispatch, id, nodeType} _ = do
let defaultUploadType = JSON
mFile <- T.useBox (Nothing :: Maybe UploadFile) mFile <- T.useBox (Nothing :: Maybe UploadFile)
uploadType <- T.useBox CSV uploadType <- T.useBox defaultUploadType
let input = H.input { type: "file" let input = H.input { type: "file"
, placeholder: "Choose file" , placeholder: "Choose file"
...@@ -387,7 +388,7 @@ uploadTermListViewCpt = here.component "uploadTermListView" cpt ...@@ -387,7 +388,7 @@ uploadTermListViewCpt = here.component "uploadTermListView" cpt
let opt fileType = H.option { value: show fileType } [ H.text $ show fileType ] let opt fileType = H.option { value: show fileType } [ H.text $ show fileType ]
let uploadTypeHtml = R2.select { className: "form-control" let uploadTypeHtml = R2.select { className: "form-control"
, defaultValue: show JSON , defaultValue: show defaultUploadType
, on: { change: onUploadTypeChange uploadType } } (opt <$> [ CSV, JSON ]) , on: { change: onUploadTypeChange uploadType } } (opt <$> [ CSV, JSON ])
let footer = H.div {} [ uploadTermButton { dispatch let footer = H.div {} [ uploadTermButton { dispatch
...@@ -447,6 +448,9 @@ uploadTermButtonCpt = here.component "uploadTermButton" cpt ...@@ -447,6 +448,9 @@ uploadTermButtonCpt = here.component "uploadTermButton" cpt
mFile' <- T.useLive T.unequal mFile mFile' <- T.useLive T.unequal mFile
uploadType' <- T.useLive T.unequal uploadType uploadType' <- T.useLive T.unequal uploadType
R.useEffect' $ do
here.log2 "[uploadTermButton] uploadType'" uploadType'
let disabled = case mFile' of let disabled = case mFile' of
Nothing -> "1" Nothing -> "1"
Just _ -> "" Just _ -> ""
......
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