Commit e70e19ad authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski Committed by Fabien Maniere

[form] add labels to action dialog forms

parent c64760c7
...@@ -100,37 +100,35 @@ addNodeViewCpt = here.component "addNodeView" cpt ...@@ -100,37 +100,35 @@ addNodeViewCpt = here.component "addNodeView" cpt
T.write_ nt nodeType T.write_ nt nodeType
maybeChoose = maybeChoose =
if length nodeTypes > 1 then if length nodeTypes > 1 then
[ Tools.formChoice Tools.formChoice
{ items: nodeTypes { items: nodeTypes
, default: nodeType' , default: nodeType'
, callback: setNodeType' , callback: setNodeType'
, print: print hasChromeAgent' , print: print hasChromeAgent'
} , label: "Node type:"
[] }
] []
else else
[ H.div {} H.div {}
[ H.text $ "Creating a node of type " [ H.text $ "Creating a node of type "
<> show defaultNodeType <> show defaultNodeType
<> " with name:" <> " with name:"
] ]
]
maybeEdit = maybeEdit =
if edit then if edit then
[ inputWithEnterWithKey inputWithEnterWithKey
{ autoFocus: true { autoFocus: true
, className: "form-control" , className: "form-control"
, defaultValue: nodeName' -- (prettyNodeType nt') , defaultValue: nodeName' -- (prettyNodeType nt')
, key: show nodeType' , key: show nodeType'
, onBlur: \val -> T.write_ val nodeName , onBlur: \val -> T.write_ val nodeName
, onEnter: \_ -> launchAff_ $ dispatch action , onEnter: \_ -> launchAff_ $ dispatch action
, onValueChanged: \val -> T.write_ val nodeName , onValueChanged: \val -> T.write_ val nodeName
, placeholder: nodeName' -- (prettyNodeType nt') , placeholder: nodeName' -- (prettyNodeType nt')
, required: false , required: false
, type: "text" , type: "text"
} }
] else H.div {} []
else []
pure $ pure $
Tools.panelWithSubmitButton Tools.panelWithSubmitButton
...@@ -140,8 +138,16 @@ addNodeViewCpt = here.component "addNodeView" cpt ...@@ -140,8 +138,16 @@ addNodeViewCpt = here.component "addNodeView" cpt
, iconName: "plus" , iconName: "plus"
, textTitle: "Add a child node element" , textTitle: "Add a child node element"
} }
[ H.div { className: "pt-2" } [ R2.row
(maybeChoose <> maybeEdit) [ R2.col 6
[ H.div { className: "form-group" } [ maybeChoose ] ]
, R2.col 6
[ H.div { className: "form-group" }
[ H.label {} [ H.text "Name:" ]
, maybeEdit
]
]
]
] ]
-- END Create Node -- END Create Node
......
...@@ -75,12 +75,12 @@ updateDashboardCpt = here.component "updateDashboard" cpt ...@@ -75,12 +75,12 @@ updateDashboardCpt = here.component "updateDashboard" cpt
, iconName: "" , iconName: ""
, textTitle: "Update the dashboard" , textTitle: "Update the dashboard"
} }
[ -- H.text "Update with" [ Tools.formChoiceSafe
Tools.formChoiceSafe
{ items: [ All, Sources, Authors, Institutes, Ngrams ] { items: [ All, Sources, Authors, Institutes, Ngrams ]
, default: methodBoard' , default: methodBoard'
, callback: \val -> T.write_ val methodBoard , callback: \val -> T.write_ val methodBoard
, print: show , print: show
, label: "Update with:"
} }
[] []
] ]
...@@ -133,12 +133,12 @@ updateGraphCpt = here.component "updateGraph" cpt ...@@ -133,12 +133,12 @@ updateGraphCpt = here.component "updateGraph" cpt
, iconName: "reload-with-settings" , iconName: "reload-with-settings"
, textTitle: "Update the graph" , textTitle: "Update the graph"
} }
[ H.text "Show subjects with Order1 or concepts with Order2 ?" [ Tools.formChoiceSafe
, Tools.formChoiceSafe
{ items: [ Order1, Order2 ] { items: [ Order1, Order2 ]
, default: methodGraphMetric' , default: methodGraphMetric'
, callback: \val -> T.write_ val methodGraphMetric , callback: \val -> T.write_ val methodGraphMetric
, print: show , print: show
, label: "Show subjects with Order1 or concepts with Order2 ?"
} }
[] []
] ]
...@@ -296,12 +296,12 @@ updateCorpusCpt = here.component "updateTexts" cpt ...@@ -296,12 +296,12 @@ updateCorpusCpt = here.component "updateTexts" cpt
] ]
-- H.p {} [ H.text "Update both term and document indexing." ] -- H.p {} [ H.text "Update both term and document indexing." ]
, H.p {} , H.p {}
[ H.text "Term update mode" [ Tools.formChoiceSafe
, Tools.formChoiceSafe
{ items: [ Basic, Advanced, WithModel ] { items: [ Basic, Advanced, WithModel ]
, default: methodList' , default: methodList'
, callback: \val -> T.write_ val methodList , callback: \val -> T.write_ val methodList
, print: show , print: show
, label: "Term update mode"
} }
[] []
] ]
...@@ -326,12 +326,12 @@ updateNodeListCpt = here.component "updateNodeList" cpt ...@@ -326,12 +326,12 @@ updateNodeListCpt = here.component "updateNodeList" cpt
, iconName: "reload-with-settings" , iconName: "reload-with-settings"
, textTitle: "Update terms" , textTitle: "Update terms"
} }
[ -- H.text "Update with" [ Tools.formChoiceSafe
Tools.formChoiceSafe
{ items: [ Basic, Advanced, WithModel ] { items: [ Basic, Advanced, WithModel ]
, default: methodList' , default: methodList'
, callback: \val -> T.write_ val methodList , callback: \val -> T.write_ val methodList
, print: show , print: show
, label: "Update with:"
} }
[] []
] ]
......
...@@ -258,7 +258,7 @@ uploadFileViewWithLangsCpt = here.component "uploadFileViewWithLangs" cpt ...@@ -258,7 +258,7 @@ uploadFileViewWithLangsCpt = here.component "uploadFileViewWithLangs" cpt
selects = selects =
if processed' then if processed' then
[ R2.row [ R2.row
[ H.div { className: "col-12 flex-space-around" } [ H.div { className: "col-12 form-group]" }
[ B.formSelect' [ B.formSelect'
{ list: { list:
[ TSV [ TSV
...@@ -286,16 +286,20 @@ uploadFileViewWithLangsCpt = here.component "uploadFileViewWithLangs" cpt ...@@ -286,16 +286,20 @@ uploadFileViewWithLangsCpt = here.component "uploadFileViewWithLangs" cpt
, H.div { className: "alert alert-info", role: "alert" } , H.div { className: "alert alert-info", role: "alert" }
[ H.text infoText' ] [ H.text infoText' ]
, R2.row , R2.row
[ H.div { className: "col-12 flex-space-around" } [ H.div { className: "col-12" }
[ H.text "Please choose the language of your documents:" [ Tools.formChoiceSafe
, Tools.formChoiceSafe
{ items: langs <> [ No_extraction ] { items: langs <> [ No_extraction ]
, default: EN , default: EN
, callback: setLang' , callback: setLang'
, print: show , print: show
, label: "Please choose the language of your documents:"
} }
[] []
, H.text "Please choose the list of terms to use:" ]
]
, R2.row
[ H.div { className: "col-12 form-group" }
[ H.label {} [ H.text "Please choose the list of terms to use:" ]
, ListSelection.selection { selection, session } [] , ListSelection.selection { selection, session } []
] ]
] ]
......
...@@ -263,6 +263,7 @@ type FormChoiceSafeProps item m = ...@@ -263,6 +263,7 @@ type FormChoiceSafeProps item m =
, default :: item , default :: item
, callback :: item -> Effect m , callback :: item -> Effect m
, print :: item -> String , print :: item -> String
, label :: String
) )
-- | Form Choice input -- | Form Choice input
...@@ -276,17 +277,18 @@ formChoiceSafe = R.createElement formChoiceSafeCpt ...@@ -276,17 +277,18 @@ formChoiceSafe = R.createElement formChoiceSafeCpt
formChoiceSafeCpt :: forall item m. Show item => R.Component (FormChoiceSafeProps item m) formChoiceSafeCpt :: forall item m. Show item => R.Component (FormChoiceSafeProps item m)
formChoiceSafeCpt = here.component "formChoiceSafe" cpt formChoiceSafeCpt = here.component "formChoiceSafe" cpt
where where
cpt { items, default, callback, print } _ = do cpt { items, default, callback, print, label } _ = do
pure $ case items of pure $ case items of
[] -> H.div {} [] [] -> H.div {} []
[ n ] -> formButton { item: n, callback, print } [] [ n ] -> formButton { item: n, callback, print } []
_ -> formChoice { items, default, callback, print } [] _ -> formChoice { items, default, callback, print, label } []
type FormChoiceProps item m = type FormChoiceProps item m =
( items :: Array item ( items :: Array item
, default :: item , default :: item
, callback :: item -> Effect m , callback :: item -> Effect m
, print :: item -> String , print :: item -> String
, label :: String
) )
-- | List Form -- | List Form
...@@ -299,9 +301,10 @@ formChoice = R.createElement formChoiceCpt ...@@ -299,9 +301,10 @@ formChoice = R.createElement formChoiceCpt
formChoiceCpt :: forall item m. Show item => R.Component (FormChoiceProps item m) formChoiceCpt :: forall item m. Show item => R.Component (FormChoiceProps item m)
formChoiceCpt = here.component "formChoice" cpt formChoiceCpt = here.component "formChoice" cpt
where where
cpt { items, callback, default, print } _ = do cpt { items, callback, default, print, label } _ = do
pure $ H.div { className: "form-group" } pure $ H.div { className: "form-group" }
[ R2.select [ H.label {} [ H.text label ]
, R2.select
{ className: "form-control with-icon-font" { className: "form-control with-icon-font"
, defaultValue: show default , defaultValue: show default
, on: { change } , on: { change }
......
...@@ -32,7 +32,7 @@ selectionCpt = here.component "selection" cpt ...@@ -32,7 +32,7 @@ selectionCpt = here.component "selection" cpt
where where
cpt { selection, session } _ = do cpt { selection, session } _ = do
selection' <- R2.useLive' selection selection' <- R2.useLive' selection
pure $ H.div { className: "list-selection p-1" } pure $ H.div { className: "list-selection" }
[ B.formSelect' [ B.formSelect'
{ callback: flip T.write_ selection { callback: flip T.write_ selection
, value: selection' , value: selection'
......
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