Commit 02b20181 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

Merge branch '706-dev-graph-params-display' into 'dev'

Resolve "Display graph parameters in legend"

Closes #706

See merge request !510
parents 18aab30e 23bc6190
Pipeline #7637 passed with stages
in 21 minutes and 55 seconds
...@@ -9750,6 +9750,20 @@ input[type=range]:-moz-focusring { ...@@ -9750,6 +9750,20 @@ input[type=range]:-moz-focusring {
margin-right: 8px; margin-right: 8px;
border: 1px solid #ADB5BD; border: 1px solid #ADB5BD;
} }
.graph-legend__separator {
fill: #B5B5B5;
}
.graph-legend__params {
margin: 16px;
}
.graph-legend__params__heading {
font-weight: bold;
list-style: none;
}
.graph-legend__params__item {
list-style: initial;
margin-left: 16px;
}
.graph-legend .renameable-container__text { .graph-legend .renameable-container__text {
margin-right: 8px; margin-right: 8px;
......
...@@ -9558,6 +9558,20 @@ input[type=range]:-moz-focusring { ...@@ -9558,6 +9558,20 @@ input[type=range]:-moz-focusring {
margin-right: 8px; margin-right: 8px;
border: 1px solid #ADB5BD; border: 1px solid #ADB5BD;
} }
.graph-legend__separator {
fill: #B5B5B5;
}
.graph-legend__params {
margin: 16px;
}
.graph-legend__params__heading {
font-weight: bold;
list-style: none;
}
.graph-legend__params__item {
list-style: initial;
margin-left: 16px;
}
.graph-legend .renameable-container__text { .graph-legend .renameable-container__text {
margin-right: 8px; margin-right: 8px;
......
...@@ -9401,6 +9401,20 @@ input[type=range]:-moz-focusring { ...@@ -9401,6 +9401,20 @@ input[type=range]:-moz-focusring {
margin-right: 8px; margin-right: 8px;
border: 1px solid #ADB5BD; border: 1px solid #ADB5BD;
} }
.graph-legend__separator {
fill: #B5B5B5;
}
.graph-legend__params {
margin: 16px;
}
.graph-legend__params__heading {
font-weight: bold;
list-style: none;
}
.graph-legend__params__item {
list-style: initial;
margin-left: 16px;
}
.graph-legend .renameable-container__text { .graph-legend .renameable-container__text {
margin-right: 8px; margin-right: 8px;
......
...@@ -9626,6 +9626,20 @@ input[type=range]:-moz-focusring { ...@@ -9626,6 +9626,20 @@ input[type=range]:-moz-focusring {
margin-right: 8px; margin-right: 8px;
border: 1px solid #ADB5BD; border: 1px solid #ADB5BD;
} }
.graph-legend__separator {
fill: #B5B5B5;
}
.graph-legend__params {
margin: 16px;
}
.graph-legend__params__heading {
font-weight: bold;
list-style: none;
}
.graph-legend__params__item {
list-style: initial;
margin-left: 16px;
}
.graph-legend .renameable-container__text { .graph-legend .renameable-container__text {
margin-right: 8px; margin-right: 8px;
......
...@@ -9699,6 +9699,20 @@ input[type=range]:-moz-focusring { ...@@ -9699,6 +9699,20 @@ input[type=range]:-moz-focusring {
margin-right: 8px; margin-right: 8px;
border: 1px solid #ADB5BD; border: 1px solid #ADB5BD;
} }
.graph-legend__separator {
fill: #B5B5B5;
}
.graph-legend__params {
margin: 16px;
}
.graph-legend__params__heading {
font-weight: bold;
list-style: none;
}
.graph-legend__params__item {
list-style: initial;
margin-left: 16px;
}
.graph-legend .renameable-container__text { .graph-legend .renameable-container__text {
margin-right: 8px; margin-right: 8px;
......
...@@ -11,11 +11,12 @@ import Gargantext.AsyncTasks as GAT ...@@ -11,11 +11,12 @@ import Gargantext.AsyncTasks as GAT
import Gargantext.Components.Bootstrap as B import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (ComponentStatus(..)) import Gargantext.Components.Bootstrap.Types (ComponentStatus(..))
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..)) import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action.Update.Types (BridgenessMethod(..), Charts(..), Granularity(..), GraphMetric(..), Method(..), Strength(..), UpdateNodeConfigGraph(..), UpdateNodeParams(..)) import Gargantext.Components.Forest.Tree.Node.Action.Update.Types (Charts(..), Granularity(..), Method(..), UpdateNodeParams(..), UpdateNodeConfigGraph(..))
import Gargantext.Components.Forest.Tree.Node.Tools as Tools import Gargantext.Components.Forest.Tree.Node.Tools as Tools
import Gargantext.Components.PhyloExplorer.API as Phylo import Gargantext.Components.PhyloExplorer.API as Phylo
import Gargantext.Components.PhyloExplorer.Config.ConfigForm as PhyloForm import Gargantext.Components.PhyloExplorer.Config.ConfigForm as PhyloForm
import Gargantext.Components.PhyloExplorer.ConfigFormParser as PhyloHook import Gargantext.Components.PhyloExplorer.ConfigFormParser as PhyloHook
import Gargantext.Components.GraphExplorer.Types (GraphMetric(..), Strength(..), PartitionMethod(..), BridgenessMethod(..))
import Gargantext.Config.REST (AffRESTError) import Gargantext.Config.REST (AffRESTError)
import Gargantext.Hooks.UseFeatureFlag as Feature import Gargantext.Hooks.UseFeatureFlag as Feature
import Gargantext.Routes as GR import Gargantext.Routes as GR
......
...@@ -5,6 +5,7 @@ import Gargantext.Prelude ...@@ -5,6 +5,7 @@ import Gargantext.Prelude
import Data.Generic.Rep (class Generic) import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
import Data.Show.Generic (genericShow) import Data.Show.Generic (genericShow)
import Gargantext.Components.GraphExplorer.Types (BridgenessMethod, GraphMetric, Strength)
import Gargantext.Components.PhyloExplorer.API as Phylo import Gargantext.Components.PhyloExplorer.API as Phylo
import Gargantext.Types as GT import Gargantext.Types as GT
import Simple.JSON as JSON import Simple.JSON as JSON
...@@ -105,63 +106,6 @@ instance Read Method where ...@@ -105,63 +106,6 @@ instance Read Method where
read "WithModel" = Just WithModel read "WithModel" = Just WithModel
read _ = Nothing read _ = Nothing
----------------------------------------------------------------------
data GraphMetric = Order1 | Order2
derive instance Generic GraphMetric _
derive instance Eq GraphMetric
instance Show GraphMetric where
show = genericShow
instance Read GraphMetric where
read "Order1" = Just Order1
read "Order2" = Just Order2
read _ = Nothing
instance JSON.ReadForeign GraphMetric where
readImpl = JSONG.enumSumRep
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 BridgenessMethod
= BridgenessBasic
| BridgenessAdvanced
derive instance Generic BridgenessMethod _
derive instance Eq BridgenessMethod
instance Show BridgenessMethod where
show = genericShow
instance Read BridgenessMethod where
read "BridgenessBasic" = Just BridgenessBasic
read "BridgenessAdvanced" = Just BridgenessAdvanced
read _ = Nothing
instance JSON.ReadForeign BridgenessMethod where
readImpl = JSONG.enumSumRep
instance JSON.WriteForeign BridgenessMethod where
writeImpl = JSON.writeImpl <<< show
---------------------------------------------------------------------- ----------------------------------------------------------------------
data Granularity = NewNgrams | NewTexts | Both data Granularity = NewNgrams | NewTexts | Both
......
...@@ -133,7 +133,7 @@ sideTabLegend = R2.leaf sideTabLegendCpt ...@@ -133,7 +133,7 @@ sideTabLegend = R2.leaf sideTabLegendCpt
sideTabLegendCpt :: R.Component Props sideTabLegendCpt :: R.Component Props
sideTabLegendCpt = here.component "sideTabLegend" cpt sideTabLegendCpt = here.component "sideTabLegend" cpt
where where
cpt { metaData: GET.MetaData { legend }, session, graphId } _ = do cpt { metaData: m@(GET.MetaData { legend }), session, graphId } _ = do
-- | States -- | States
-- | -- |
store <- GraphStore.use store <- GraphStore.use
...@@ -171,6 +171,7 @@ sideTabLegendCpt = here.component "sideTabLegend" cpt ...@@ -171,6 +171,7 @@ sideTabLegendCpt = here.component "sideTabLegend" cpt
, selectedNodeIds: store.selectedNodeIds , selectedNodeIds: store.selectedNodeIds
, session , session
, graphId , graphId
, metaData: m
} }
] ]
......
...@@ -37,6 +37,7 @@ type Props = ...@@ -37,6 +37,7 @@ type Props =
, selectedNodeIds :: T.Box ST.NodeIds , selectedNodeIds :: T.Box ST.NodeIds
, session :: Session , session :: Session
, graphId :: GET.GraphId , graphId :: GET.GraphId
, metaData :: GET.MetaData
) )
legend :: R2.Leaf Props legend :: R2.Leaf Props
...@@ -52,6 +53,7 @@ legendCpt = here.component "legend" cpt ...@@ -52,6 +53,7 @@ legendCpt = here.component "legend" cpt
, selectedNodeIds , selectedNodeIds
, session , session
, graphId , graphId
, metaData: GET.MetaData m
} }
_ = do _ = do
-- | Hooks -- | Hooks
...@@ -84,6 +86,40 @@ legendCpt = here.component "legend" cpt ...@@ -84,6 +86,40 @@ legendCpt = here.component "legend" cpt
] ]
] ]
] ]
, H.hr
{ className: "graph-legend__separator" }
-- Graph params
, H.ul
{ className: "graph-legend__params" }
[ H.li
{ className: "graph-legend__params__heading" }
[ H.text "Graph parameters:"
]
, H.li
{ className: "graph-legend__params__item" }
[ H.text $ "Version: " <> show m.list.version
]
, H.li
{ className: "graph-legend__params__item" }
[ H.text $ "Metric: " <> show m.metric
]
, H.li
{ className: "graph-legend__params__item" }
[ H.text $ "Start Force Atlas: " <> show m.startForceAtlas
]
, H.li
{ className: "graph-legend__params__item" }
[ H.text $ "Edges Strength: " <> maybe "null" show m.edgesStrength
]
-- , H.li
-- { className: "graph-legend__params__item" }
-- [ H.text $ "PartitionMethod: " <> maybe "null" show m.partitionMethod
-- ]
, H.li
{ className: "graph-legend__params__item" }
[ H.text $ "Bridgeness Method: " <> maybe "null" show m.bridgenessMethod
]
]
] ]
where where
rename :: String -> Int -> String -> Effect Unit rename :: String -> Int -> String -> Effect Unit
......
...@@ -29,6 +29,7 @@ import Gargantext.Components.Bootstrap.Types (ButtonVariant(..), Variant(..)) ...@@ -29,6 +29,7 @@ import Gargantext.Components.Bootstrap.Types (ButtonVariant(..), Variant(..))
import Gargantext.Components.Forest.Tree.Node.Action.Upload (uploadArbitraryData) import Gargantext.Components.Forest.Tree.Node.Action.Upload (uploadArbitraryData)
import Gargantext.Components.Forest.Tree.Node.Action.Upload.Types (FileFormat(..)) import Gargantext.Components.Forest.Tree.Node.Action.Upload.Types (FileFormat(..))
import Gargantext.Components.GraphExplorer.API (cloneGraph) import Gargantext.Components.GraphExplorer.API (cloneGraph)
import Gargantext.Components.GraphExplorer.Types (GraphMetric(..))
import Gargantext.Components.GraphExplorer.Types as GET import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Components.GraphExplorer.Utils as GEU import Gargantext.Components.GraphExplorer.Utils as GEU
import Gargantext.Data.Louvain as DLouvain import Gargantext.Data.Louvain as DLouvain
...@@ -235,9 +236,12 @@ louvainButtonCpt = here.component "louvainButton" cpt ...@@ -235,9 +236,12 @@ louvainButtonCpt = here.component "louvainButton" cpt
{ corpusId: [] { corpusId: []
, legend: legend' , legend: legend'
, list: { listId: 0, version: 0 } , list: { listId: 0, version: 0 }
, metric: "Order1" , metric: Order1
, startForceAtlas: true , startForceAtlas: true
, title: "" , title: ""
, edgesStrength: Nothing
, partitionMethod: Nothing
, bridgenessMethod: Nothing
} }
T.write_ mMetaData'' mMetaData T.write_ mMetaData'' mMetaData
T.write_ lgraph transformedGraph T.write_ lgraph transformedGraph
......
module Gargantext.Components.GraphExplorer.Types where module Gargantext.Components.GraphExplorer.Types where
import Gargantext.Components.GraphExplorer.GraphTypes
import Gargantext.Prelude
import Data.Array ((!!), length) import Data.Array ((!!), length)
import Data.Eq.Generic (genericEq) import Data.Eq.Generic (genericEq)
import Data.Generic.Rep (class Generic) import Data.Generic.Rep (class Generic)
...@@ -7,12 +10,11 @@ import Data.Maybe (Maybe(..), fromJust) ...@@ -7,12 +10,11 @@ import Data.Maybe (Maybe(..), fromJust)
import Data.Newtype (class Newtype) import Data.Newtype (class Newtype)
import Data.Ord.Generic (genericCompare) import Data.Ord.Generic (genericCompare)
import Data.Show.Generic (genericShow) import Data.Show.Generic (genericShow)
import Gargantext.Components.GraphExplorer.GraphTypes
import Gargantext.Hooks.Sigmax.Camera (Camera) import Gargantext.Hooks.Sigmax.Camera (Camera)
import Gargantext.Prelude
import Partial.Unsafe (unsafePartial) import Partial.Unsafe (unsafePartial)
import Record as Record import Record as Record
import Simple.JSON as JSON import Simple.JSON as JSON
import Simple.JSON.Generics as JSONG
type GraphId = Int type GraphId = Int
...@@ -94,9 +96,12 @@ newtype MetaData = MetaData ...@@ -94,9 +96,12 @@ newtype MetaData = MetaData
{ listId :: ListId { listId :: ListId
, version :: Version , version :: Version
} }
, metric :: String -- dummy value , metric :: GraphMetric -- dummy value
, startForceAtlas :: Boolean , startForceAtlas :: Boolean
, title :: String , title :: String
, edgesStrength :: Maybe Strength
, partitionMethod :: Maybe PartitionMethod
, bridgenessMethod :: Maybe BridgenessMethod
} }
derive instance Generic MetaData _ derive instance Generic MetaData _
...@@ -147,12 +152,92 @@ initialGraphData = GraphData ...@@ -147,12 +152,92 @@ initialGraphData = GraphData
{ corpusId: [] { corpusId: []
, legend: [] , legend: []
, list: { listId: 0, version: 0 } , list: { listId: 0, version: 0 }
, metric: "Order1" , metric: Order1
, startForceAtlas: true , startForceAtlas: true
, title: "" , title: ""
, edgesStrength: Nothing
, partitionMethod: Nothing
, bridgenessMethod: Nothing
} }
} }
----------------------------------------------------------------------
data GraphMetric = Order1 | Order2
derive instance Generic GraphMetric _
derive instance Eq GraphMetric
instance Show GraphMetric where
show = genericShow
instance Read GraphMetric where
read "Order1" = Just Order1
read "Order2" = Just Order2
read _ = Nothing
instance JSON.ReadForeign GraphMetric where
readImpl = JSONG.enumSumRep
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
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 "Infomap" = Just Infomap
read _ = Nothing
instance JSON.ReadForeign PartitionMethod where
readImpl = JSONG.enumSumRep
instance JSON.WriteForeign PartitionMethod where
writeImpl = JSON.writeImpl <<< show
data BridgenessMethod
= BridgenessBasic
| BridgenessAdvanced
derive instance Generic BridgenessMethod _
derive instance Eq BridgenessMethod
instance Show BridgenessMethod where
show = genericShow
instance Read BridgenessMethod where
read "BridgenessBasic" = Just BridgenessBasic
read "BridgenessAdvanced" = Just BridgenessAdvanced
read _ = Nothing
instance JSON.ReadForeign BridgenessMethod where
readImpl = JSONG.enumSumRep
instance JSON.WriteForeign BridgenessMethod where
writeImpl = JSON.writeImpl <<< show
----------------------------------------------------------------------
newtype Legend = Legend { id_ :: Int, color :: String, label :: String } newtype Legend = Legend { id_ :: Int, color :: String, label :: String }
derive instance Generic Legend _ derive instance Generic Legend _
......
...@@ -229,6 +229,24 @@ ...@@ -229,6 +229,24 @@
margin-right: space-x(1); margin-right: space-x(1);
border: 1px solid $gray-500; border: 1px solid $gray-500;
} }
&__separator {
fill: #B5B5B5;
}
&__params {
margin: space-x(2);
&__heading {
font-weight: bold;
list-style: none;
}
&__item {
list-style: initial;
margin-left: space-x(2)
}
}
} }
.graph-legend .renameable-container__text { .graph-legend .renameable-container__text {
......
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