Commit 0ad2f78f authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FEAT] Graph update method

parent 319d2496
......@@ -46,7 +46,13 @@ update NodeList dispatch = do
]
(submitButton (UpdateNode $ UpdateNodeParamsList {method}) dispatch)
update Graph _ = pure $ H.div {} []
update Graph dispatch = do
meth @( method /\ setMethod ) <- R.useState' Order1
pure $ panel [ -- H.text "Update with"
formChoiceSafe [Order1, Order2] Order1 setMethod
]
(submitButton (UpdateNode $ UpdateNodeParamsGraph {method}) dispatch)
update Texts _ = pure $ H.div {} []
update _ _ = pure $ H.div {} []
......
......@@ -9,7 +9,7 @@ import Gargantext.Prelude (class Eq, class Read, class Show)
data UpdateNodeParams = UpdateNodeParamsList { method :: Method }
| UpdateNodeParamsGraph { method :: String }
| UpdateNodeParamsGraph { method :: Metric }
| UpdateNodeParamsTexts { method :: Int }
......@@ -48,4 +48,47 @@ instance decodeJsonMethod :: Argonaut.DecodeJson Method where
instance encodeJsonMethod :: Argonaut.EncodeJson Method where
encodeJson = genericSumEncodeJson
----------------------------------------------------------------------
data Metric = Order1 | Order2
derive instance genericMetric :: Generic Metric _
derive instance eqMetric :: Eq Metric
instance showMetric :: Show Metric where
show = genericShow
instance readMetric :: Read Metric where
read "Order1" = Just Order1
read "Order2" = Just Order2
read _ = Nothing
instance decodeJsonMetric :: Argonaut.DecodeJson Metric where
decodeJson = genericSumDecodeJson
instance encodeJsonMetric :: Argonaut.EncodeJson Metric where
encodeJson = genericSumEncodeJson
----------------------------------------------------------------------
data Metric = Order1 | Order2
derive instance genericMetric :: Generic Metric _
derive instance eqMetric :: Eq Metric
instance showMetric :: Show Metric where
show = genericShow
instance readMetric :: Read Metric where
read "Order1" = Just Order1
read "Order2" = Just Order2
read _ = Nothing
instance decodeJsonMetric :: Argonaut.DecodeJson Metric where
decodeJson = genericSumDecodeJson
instance encodeJsonMetric :: Argonaut.EncodeJson Metric where
encodeJson = genericSumEncodeJson
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