Commit 72eab75f authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FEAT] Board update method (WIP)

parent 137702d0
......@@ -34,6 +34,12 @@ updateRequest (UpdateNodeParamsTexts meth) session nodeId = do
where
p = GR.NodeAPI GT.Node (Just nodeId) (GT.asyncTaskTypePath GT.UpdateNode)
updateRequest (UpdateNodeParamsBoard meth) session nodeId = do
task <- put session p meth
pure $ GT.AsyncTaskWithType {task, typ: GT.UpdateNode } -- TODO add NodeType
where
p = GR.NodeAPI GT.Node (Just nodeId) (GT.asyncTaskTypePath GT.UpdateNode)
----------------------------------------------------------------------
update :: NodeType
......@@ -60,6 +66,13 @@ update Texts dispatch = do
]
(submitButton (UpdateNode $ UpdateNodeParamsTexts {method}) dispatch)
update Dashboard dispatch = do
meth @( method /\ setMethod ) <- R.useState' AllCharts
pure $ panel [ -- H.text "Update with"
formChoiceSafe [AllCharts] AllCharts setMethod
]
(submitButton (UpdateNode $ UpdateNodeParamsBoard {method}) dispatch)
update _ _ = pure $ H.div {} []
-- fragmentPT $ "Update " <> show nodeType
......@@ -11,7 +11,7 @@ import Gargantext.Prelude (class Eq, class Read, class Show)
data UpdateNodeParams = UpdateNodeParamsList { method :: Method }
| UpdateNodeParamsGraph { method :: Metric }
| UpdateNodeParamsTexts { method :: Granularity }
| UpdateNodeParamsBoard { method :: Charts }
derive instance eqUpdateNodeParams :: Eq UpdateNodeParams
......@@ -93,3 +93,24 @@ instance encodeJsonGranularity :: Argonaut.EncodeJson Granularity where
encodeJson = genericSumEncodeJson
----------------------------------------------------------------------
data Charts = AllCharts
derive instance genericChart :: Generic Charts _
derive instance eqChart :: Eq Charts
instance showChart :: Show Charts where
show = genericShow
instance readChart :: Read Charts where
read "AllCharts" = Just AllCharts
read _ = Nothing
instance decodeJsonChart :: Argonaut.DecodeJson Charts where
decodeJson = genericSumDecodeJson
instance encodeJsonChart :: Argonaut.EncodeJson Charts where
encodeJson = genericSumEncodeJson
......@@ -198,7 +198,9 @@ settingsBox Dashboard =
SettingsBox { show : true
, edit : false
, doc : Documentation Dashboard
, buttons : []
, buttons : [ Refresh
, Delete
]
}
settingsBox Annuaire =
......
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