Commit 2a9c6329 authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge remote-tracking branch 'origin/graph-explorer-ui' into masterMerge

parents 4fed7755 b032dd7b
...@@ -34,6 +34,7 @@ data Action ...@@ -34,6 +34,7 @@ data Action
= LoadGraph Int = LoadGraph Int
| SelectNode SelectedNode | SelectNode SelectedNode
| ShowSidePanel | ShowSidePanel
| ShowControls
newtype SelectedNode = SelectedNode {id :: String, label :: String} newtype SelectedNode = SelectedNode {id :: String, label :: String}
...@@ -47,6 +48,7 @@ newtype State = State ...@@ -47,6 +48,7 @@ newtype State = State
, legendData :: Array Legend , legendData :: Array Legend
, selectedNode :: Maybe SelectedNode , selectedNode :: Maybe SelectedNode
, showSidePanel :: Boolean , showSidePanel :: Boolean
, showControls :: Boolean
} }
initialState :: State initialState :: State
...@@ -57,6 +59,7 @@ initialState = State ...@@ -57,6 +59,7 @@ initialState = State
, legendData : [] , legendData : []
, selectedNode : Nothing , selectedNode : Nothing
, showSidePanel : false , showSidePanel : false
, showControls : false
} }
graphSpec :: Spec State {} Action graphSpec :: Spec State {} Action
...@@ -81,6 +84,10 @@ performAction (SelectNode node) _ _ = void do ...@@ -81,6 +84,10 @@ performAction (SelectNode node) _ _ = void do
performAction (ShowSidePanel) _ (State state) = void do performAction (ShowSidePanel) _ (State state) = void do
modifyState $ \(State s) -> State s {showSidePanel = not (state.showSidePanel) } modifyState $ \(State s) -> State s {showSidePanel = not (state.showSidePanel) }
performAction (ShowControls) _ (State state) = void do
modifyState $ \(State s) -> State s {showControls = not (state.showControls) }
convert :: GraphData -> SigmaGraphData convert :: GraphData -> SigmaGraphData
convert (GraphData r) = SigmaGraphData { nodes, edges} convert (GraphData r) = SigmaGraphData { nodes, edges}
where where
...@@ -273,7 +280,20 @@ specOld = simpleSpec performAction render' ...@@ -273,7 +280,20 @@ specOld = simpleSpec performAction render'
where where
render' :: Render State {} Action render' :: Render State {} Action
render' d _ (State st) _ = render' d _ (State st) _ =
[ div [className "row"] [ [ div [className "row"]
[
div [className "col-md-12"]
[ button [className "btn btn-primary"
, onClick \_ -> d ShowControls
,style {position:"relative",top:"-25px",left: "737px"}
]
[text "Show Controls"]
, button [className "btn btn-primary"
, style {position:"relative",top:"-25px",left: "1380px"}
,onClick \_ -> d ShowSidePanel
] [text "showSidePanel"]
]
, if (st.showControls) then
div [className "col-md-12", style {marginBottom : "21px"}] div [className "col-md-12", style {marginBottom : "21px"}]
[ menu [_id "toolbar"] [ menu [_id "toolbar"]
[ ul' [ ul'
...@@ -341,6 +361,7 @@ specOld = simpleSpec performAction render' ...@@ -341,6 +361,7 @@ specOld = simpleSpec performAction render'
] ]
] ]
] ]
else div [] []
] ]
, div [className "row"] , div [className "row"]
[ div [if (st.showSidePanel) then className "col-md-10" else className "col-md-11"] [ div [if (st.showSidePanel) then className "col-md-10" else className "col-md-11"]
...@@ -368,7 +389,7 @@ specOld = simpleSpec performAction render' ...@@ -368,7 +389,7 @@ specOld = simpleSpec performAction render'
<> <>
if length st.legendData > 0 then [div [style {position : "absolute", bottom : "10px", border: "1px solid black", boxShadow : "rgb(0, 0, 0) 0px 2px 6px", marginLeft : "10px", padding: "16px"}] [dispLegend st.legendData]] else [] if length st.legendData > 0 then [div [style {position : "absolute", bottom : "10px", border: "1px solid black", boxShadow : "rgb(0, 0, 0) 0px 2px 6px", marginLeft : "10px", padding: "16px"}] [dispLegend st.legendData]] else []
] ]
, button [onClick \_ -> d ShowSidePanel, className "btn btn-primary", style {right:"0px",position : "relative",zIndex:"1000"}] [text "show sidepanel"] --, button [onClick \_ -> d ShowSidePanel, className "btn btn-primary", style {right:"39px",position : "relative",zIndex:"1000", top: "-59px"}] [text "Show SidePanel"]
, if (st.showSidePanel) then , if (st.showSidePanel) then
div [_id "sp-container",className "col-md-2", style {border : "1px black solid", backgroundColor : "beige", position:"absolute",right: "0px",top:"265px"}] div [_id "sp-container",className "col-md-2", style {border : "1px black solid", backgroundColor : "beige", position:"absolute",right: "0px",top:"265px"}]
[ div [className "row"] [ div [className "row"]
......
...@@ -134,7 +134,7 @@ layout1 layout = ...@@ -134,7 +134,7 @@ layout1 layout =
] ]
ls = over _render \render d p s c -> [ ls = over _render \render d p s c -> [
button [onClick $ \e -> d ShowTree, className "btn btn-primary",style {position:"relative", top: "68px",left:"-264px",zIndex : "1000"}] [text "ShowTree"] button [onClick $ \e -> d ShowTree, className "btn btn-primary",style {position:"relative", top: "99px",left:"-264px",zIndex : "1000"}] [text "ShowTree"]
, div [if (s.showTree) then className "col-md-2" else className "col-md-2"] if (s.showTree) then (render d p s c) else [] , div [if (s.showTree) then className "col-md-2" else className "col-md-2"] if (s.showTree) then (render d p s c) else []
] ]
......
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