Commit 7b00e9fa authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FEA] Graph options with Links Strength

parent 0487ad41
...@@ -2,7 +2,7 @@ module Gargantext.Components.Forest.Tree.Node.Action.Update where ...@@ -2,7 +2,7 @@ module Gargantext.Components.Forest.Tree.Node.Action.Update where
import Gargantext.Prelude import Gargantext.Prelude
import Gargantext.Components.Forest.Tree.Node.Action.Update.Types (Charts(..), Granularity(..), GraphMetric(..), Method(..), PartitionMethod(..), UpdateNodeParams(..)) import Gargantext.Components.Forest.Tree.Node.Action.Update.Types (Charts(..), Granularity(..), GraphMetric(..), Method(..), PartitionMethod(..), UpdateNodeParams(..), Strength(..))
import DOM.Simple.Console (log3) import DOM.Simple.Console (log3)
import Data.Either (Either(..)) import Data.Either (Either(..))
...@@ -78,6 +78,9 @@ updateGraphCpt = here.component "updateGraph" cpt where ...@@ -78,6 +78,9 @@ updateGraphCpt = here.component "updateGraph" cpt where
methodGraphMetric <- T.useBox Order1 methodGraphMetric <- T.useBox Order1
methodGraphMetric' <- T.useLive T.unequal methodGraphMetric methodGraphMetric' <- T.useLive T.unequal methodGraphMetric
methodGraphEdgesStrength <- T.useBox Strong
methodGraphEdgesStrength' <- T.useLive T.unequal methodGraphEdgesStrength
methodGraphClustering <- T.useBox Spinglass methodGraphClustering <- T.useBox Spinglass
methodGraphClustering' <- T.useLive T.unequal methodGraphClustering methodGraphClustering' <- T.useLive T.unequal methodGraphClustering
...@@ -85,11 +88,18 @@ updateGraphCpt = here.component "updateGraph" cpt where ...@@ -85,11 +88,18 @@ updateGraphCpt = here.component "updateGraph" cpt where
callback :: Action -> Aff Unit callback :: Action -> Aff Unit
callback = dispatch >=> \_ -> dispatch ClosePopover callback = dispatch >=> \_ -> dispatch ClosePopover
pure $ panel [ -- H.text "Update with" pure $ panel [ H.text "Show subjects with Order1 or concepts with Order2 ?"
formChoiceSafe { items: [Order1, Order2] , formChoiceSafe { items: [Order1, Order2]
, default: methodGraphMetric' , default: methodGraphMetric'
, callback: \val -> T.write_ val methodGraphMetric , callback: \val -> T.write_ val methodGraphMetric
, print: show } [] , print: show } []
, H.text "Show Strong (expected) links or weak (maybe unexpected) links?"
, formChoiceSafe { items: [Strong, Weak]
, default: methodGraphEdgesStrength'
, callback: \val -> T.write_ val methodGraphEdgesStrength
, print: show } []
, formChoiceSafe { items: [Spinglass, Infomap, Confluence] , formChoiceSafe { items: [Spinglass, Infomap, Confluence]
, default: methodGraphClustering' , default: methodGraphClustering'
, callback: \val -> T.write_ val methodGraphClustering , callback: \val -> T.write_ val methodGraphClustering
...@@ -98,6 +108,7 @@ updateGraphCpt = here.component "updateGraph" cpt where ...@@ -98,6 +108,7 @@ updateGraphCpt = here.component "updateGraph" cpt where
] ]
(submitButton (UpdateNode $ UpdateNodeParamsGraph { methodGraphMetric: methodGraphMetric' (submitButton (UpdateNode $ UpdateNodeParamsGraph { methodGraphMetric: methodGraphMetric'
, methodGraphClustering: methodGraphClustering' , methodGraphClustering: methodGraphClustering'
, methodGraphEdgesStrength : methodGraphEdgesStrength'
} }
) callback ) callback
) )
......
...@@ -14,6 +14,7 @@ import Simple.JSON.Generics as JSONG ...@@ -14,6 +14,7 @@ import Simple.JSON.Generics as JSONG
data UpdateNodeParams data UpdateNodeParams
= UpdateNodeParamsList { methodList :: Method } = UpdateNodeParamsList { methodList :: Method }
| UpdateNodeParamsGraph { methodGraphMetric :: GraphMetric | UpdateNodeParamsGraph { methodGraphMetric :: GraphMetric
, methodGraphEdgesStrength :: Strength
, methodGraphClustering :: PartitionMethod , methodGraphClustering :: PartitionMethod
} }
| UpdateNodeParamsTexts { methodTexts :: Granularity } | UpdateNodeParamsTexts { methodTexts :: Granularity }
...@@ -28,9 +29,9 @@ instance JSON.WriteForeign UpdateNodeParams where ...@@ -28,9 +29,9 @@ instance JSON.WriteForeign UpdateNodeParams where
writeImpl (UpdateNodeParamsList { methodList }) = writeImpl (UpdateNodeParamsList { methodList }) =
JSON.writeImpl { type: "UpdateNodeParamsList" JSON.writeImpl { type: "UpdateNodeParamsList"
, methodList } , methodList }
writeImpl (UpdateNodeParamsGraph { methodGraphMetric, methodGraphClustering }) = writeImpl (UpdateNodeParamsGraph { methodGraphMetric, methodGraphClustering, methodGraphEdgesStrength}) =
JSON.writeImpl { type: "UpdateNodeParamsGraph" JSON.writeImpl { type: "UpdateNodeParamsGraph"
, methodGraphMetric, methodGraphClustering } , methodGraphMetric, methodGraphClustering, methodGraphEdgesStrength}
writeImpl (UpdateNodeParamsTexts { methodTexts }) = writeImpl (UpdateNodeParamsTexts { methodTexts }) =
JSON.writeImpl { type: "UpdateNodeParamsTexts" JSON.writeImpl { type: "UpdateNodeParamsTexts"
, methodTexts } , methodTexts }
...@@ -71,6 +72,19 @@ instance Read GraphMetric where ...@@ -71,6 +72,19 @@ instance Read GraphMetric where
instance JSON.ReadForeign GraphMetric where readImpl = JSONG.enumSumRep instance JSON.ReadForeign GraphMetric where readImpl = JSONG.enumSumRep
instance JSON.WriteForeign GraphMetric where writeImpl = JSON.writeImpl <<< show instance JSON.WriteForeign GraphMetric where writeImpl = JSON.writeImpl <<< show
data Strength = Strong | Weak
derive instance Generic Strength _
derive instance Eq Strength
instance Show Strength where show = genericShow
instance Read Strength where
read "Strong" = Just Strong
read "Weak" = Just Weak
read _ = Nothing
instance JSON.ReadForeign Strength where readImpl = JSONG.enumSumRep
instance JSON.WriteForeign Strength where writeImpl = JSON.writeImpl <<< show
data PartitionMethod = Spinglass | Infomap | Confluence data PartitionMethod = Spinglass | Infomap | Confluence
derive instance Generic PartitionMethod _ derive instance Generic PartitionMethod _
derive instance Eq PartitionMethod derive instance Eq PartitionMethod
......
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