Commit 88d5ef55 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FEAT] connecting Graph Clustering Method

parent dcdc8e5e
......@@ -66,16 +66,30 @@ updateGraph = R.createElement updateGraphCpt
updateGraphCpt :: R.Component UpdateProps
updateGraphCpt = here.component "updateGraph" cpt where
cpt { dispatch } _ = do
methodGraph <- T.useBox Order1
methodGraph' <- T.useLive T.unequal methodGraph
methodGraphMetric <- T.useBox Order1
methodGraphMetric' <- T.useLive T.unequal methodGraphMetric
methodGraphClustering <- T.useBox Spinglass
methodGraphClustering' <- T.useLive T.unequal methodGraphClustering
pure $ panel [ -- H.text "Update with"
formChoiceSafe { items: [Order1, Order2]
, default: methodGraph'
, callback: \val -> T.write_ val methodGraph
, default: methodGraphMetric'
, callback: \val -> T.write_ val methodGraphMetric
, print: show } []
, formChoiceSafe { items: [Spinglass, Confluence]
, default: methodGraphClustering'
, callback: \val -> T.write_ val methodGraphClustering
, print: show } []
]
(submitButton (UpdateNode $ UpdateNodeParamsGraph { methodGraph: methodGraph' }) dispatch)
(submitButton (UpdateNode $ UpdateNodeParamsGraph { methodGraphMetric: methodGraphMetric'
, methodGraphClustering: methodGraphClustering'
}
) dispatch
)
updateNodeList :: R2.Component UpdateProps
updateNodeList = R.createElement updateNodeListCpt
......
......@@ -10,7 +10,9 @@ import Gargantext.Prelude
data UpdateNodeParams = UpdateNodeParamsList { methodList :: Method }
| UpdateNodeParamsGraph { methodGraph :: GraphMetric }
| UpdateNodeParamsGraph { methodGraphMetric :: GraphMetric
, methodGraphClustering :: PartitionMethod
}
| UpdateNodeParamsTexts { methodTexts :: Granularity }
| UpdateNodeParamsBoard { methodBoard :: Charts }
derive instance Eq UpdateNodeParams
......@@ -21,9 +23,9 @@ instance JSON.WriteForeign UpdateNodeParams where
writeImpl (UpdateNodeParamsList { methodList }) =
JSON.writeImpl { type: "UpdateNodeParamsList"
, methodList }
writeImpl (UpdateNodeParamsGraph { methodGraph }) =
writeImpl (UpdateNodeParamsGraph { methodGraphMetric, methodGraphClustering }) =
JSON.writeImpl { type: "UpdateNodeParamsGraph"
, methodGraph }
, methodGraphMetric, methodGraphClustering }
writeImpl (UpdateNodeParamsTexts { methodTexts }) =
JSON.writeImpl { type: "UpdateNodeParamsTexts"
, methodTexts }
......@@ -55,6 +57,17 @@ instance Read GraphMetric where
read _ = Nothing
instance JSON.ReadForeign GraphMetric where readImpl = JSONG.enumSumRep
instance JSON.WriteForeign GraphMetric where writeImpl = JSON.writeImpl <<< show
data PartitionMethod = Spinglass | Confluence
derive instance Generic PartitionMethod _
derive instance Eq PartitionMethod
instance Show PartitionMethod where show = genericShow
instance Read PartitionMethod where
read "Spinglass" = Just Spinglass
read "Confluence" = Just Confluence
read _ = Nothing
instance JSON.ReadForeign PartitionMethod where readImpl = JSONG.enumSumRep
instance JSON.WriteForeign PartitionMethod where writeImpl = JSON.writeImpl <<< show
----------------------------------------------------------------------
......
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