Commit 967ddf27 authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge branch 'graph-explorer-ui' of...

Merge branch 'graph-explorer-ui' of ssh://gitlab.iscpif.fr:20022/gargantext/purescript-gargantext into masterMerge
parents 049ba618 541a25f6
......@@ -100,7 +100,7 @@ li a#rename {
display:none;
position:absolute;
text-decoration:none;
left: 77px;
left: 142px;
}
li:hover a#rename {
......@@ -157,3 +157,9 @@ text-align: center;
text-decoration:none;
}
#sp-container
{ -webkit-transition: width 2s; /* For Safari 3.1 to 6.0 */
transition: width 2s;
}
15747
\ No newline at end of file
......@@ -349,10 +349,10 @@ toHtml :: (Action -> Effect Unit) -> FTree -> ReactElement
toHtml d s@(NTree (LNode {id, name, nodeType, open, popOver, renameNodeValue, createNode,nodeValue, showRenameBox }) []) =
ul []
[
li []
li [] $
[
a [ href (toUrl Front nodeType (Just id))]
a [onClick $ (\e-> d $ ToggleFolder id)] [i [fldr open] []]
, a [ href (toUrl Front nodeType (Just id))]
( [ text (name <> " ")
]
)
......@@ -371,7 +371,11 @@ toHtml d s@(NTree (LNode {id, name, nodeType, open, popOver, renameNodeValue,cre
( [ a [onClick $ (\e-> d $ ToggleFolder id)] [i [fldr open] []]
, a [ href (toUrl Front nodeType (Just id))]
[ text $ " " <> name <> " " ]
, a [className "glyphicon glyphicon-cog", _id "rename",onClick $ (\_-> d $ (ShowPopOver id))]
[
]
, if (popOver == true) then (renameTreeView d s id) else (renameTreeViewDummy d s)
, if (createNode == true) then (createNodeView d s id) else (renameTreeViewDummy d s)
] <>
if open then
......
......@@ -24,15 +24,16 @@ import Math (cos, sin)
import Partial.Unsafe (unsafePartial)
import React (ReactElement)
import React.DOM (a, br', button, div, form', input, li, li', menu, option, p, select, span, text, ul, ul')
import React.DOM.Props (_id, _type, checked, className, href, name, onChange, placeholder, style, title, value)
import React.DOM.Props (_id, _type, checked, className, href, name, onChange, onClick,placeholder, style, title, value)
import Thermite (PerformAction, Render, Spec, modifyState, simpleSpec)
import Unsafe.Coerce (unsafeCoerce)
data Action
= LoadGraph Int --- need to make it as String
= LoadGraph Int
| SelectNode SelectedNode
| ShowSidePanel
newtype SelectedNode = SelectedNode {id :: String, label :: String}
......@@ -45,6 +46,7 @@ newtype State = State
, sigmaGraphData :: Maybe SigmaGraphData
, legendData :: Array Legend
, selectedNode :: Maybe SelectedNode
, showSidePanel :: Boolean
}
initialState :: State
......@@ -54,6 +56,7 @@ initialState = State
, sigmaGraphData : Nothing
, legendData : []
, selectedNode : Nothing
, showSidePanel : false
}
graphSpec :: Spec State {} Action
......@@ -75,6 +78,9 @@ performAction (LoadGraph fp) _ _ = void do
performAction (SelectNode node) _ _ = void do
modifyState $ \(State s) -> State s {selectedNode = pure node}
performAction (ShowSidePanel) _ (State state) = void do
modifyState $ \(State s) -> State s {showSidePanel = not (state.showSidePanel) }
convert :: GraphData -> SigmaGraphData
convert (GraphData r) = SigmaGraphData { nodes, edges}
where
......@@ -268,7 +274,7 @@ specOld = simpleSpec performAction render'
render' :: Render State {} Action
render' d _ (State st) _ =
[ div [className "row"] [
div [className "col-md-12", style {marginTop : "34px", marginBottom : "21px"}]
div [className "col-md-12", style {marginBottom : "21px"}]
[ menu [_id "toolbar"]
[ ul'
[
......@@ -331,12 +337,13 @@ specOld = simpleSpec performAction render'
, li'
[ button [className "btn btn-primary"] [text "Save"] -- TODO: Implement Save!
]
]
]
]
]
, div [className "row"]
[ div [className "col-md-9"]
[ div [if (st.showSidePanel) then className "col-md-10" else className "col-md-11"]
[ div [style {border : "1px black solid", height: "90%"}] $
[
]
......@@ -361,9 +368,11 @@ 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 []
]
, div [className "col-md-3", style {border : "1px black solid", backgroundColor : "beige"}]
, button [onClick \_ -> d ShowSidePanel, className "btn btn-primary", style {right:"0px",position : "relative",zIndex:"1000"}] [text "show sidepanel"]
, 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 [className "row"]
[ div [_id "sidepanel" , className "col-md-12", style {borderBottom : "1px solid black"}]
[ div [_id "sidepanel" , style {borderBottom : "1px solid black"}]
[ case st.selectedNode of
Nothing -> span [] []
Just selectedNode -> p [] [text $ "selected Node : " <> getter _.label selectedNode
......@@ -459,6 +468,8 @@ specOld = simpleSpec performAction render'
]
]
]
else
div [] [] -- ends sidepanel column here
]
]
......
......@@ -38,6 +38,7 @@ data Action
| Go
| ShowLogin
| ShowAddcorpus
| ShowTree
performAction :: PerformAction AppState {} Action
......@@ -46,6 +47,9 @@ performAction (SetRoute route) _ _ = void do
performAction (Search s) _ _ = void do
modifyState $ _ {search = s}
performAction (ShowTree) _ (state) = void do
modifyState $ _ {showTree = not (state.showTree)}
performAction (ShowLogin) _ _ = void do
liftEffect $ modalShow "loginModal"
modifyState $ _ {showLogin = true}
......
......@@ -59,7 +59,7 @@ pagesComponent s = case s.currentRoute of
selectSpec AddCorpus = layout0 $ focus _addCorpusState _addCorpusAction AC.layoutAddcorpus
selectSpec SearchView = layout0 $ focus _searchState _searchAction S.searchSpec
selectSpec (Document i) = layout0 $ focus _documentViewState _documentViewAction Annotation.docview
selectSpec (PGraphExplorer i) = layout0 $ focus _graphExplorerState _graphExplorerAction GE.specOld
selectSpec (PGraphExplorer i) = layout1 $ focus _graphExplorerState _graphExplorerAction GE.specOld
selectSpec Dashboard = layout0 $ noState Dsh.layoutDashboard
selectSpec (Annuaire i) = layout0 $ cmapProps (const {annuaireId: i}) $ noState A.layout
......@@ -87,9 +87,54 @@ layout0 layout =
if ((\(LN.State s) -> s.loginC) st.loginState == true)
then ls as
else outerLayout1
, rs bs ]
ls = over _render \render d p s c -> [ div [className "col-md-2" ] (render d p s c) ]
rs = over _render \render d p s c -> [ div [className "col-md-10"] (render d p s c) ]
, rs bs
]
ls = over _render \render d p s c -> [
div [ className "col-md-2"] (render d p s c)
]
rs = over _render \render d p s c -> [ div [ className "col-md-10"] (render d p s c) ]
cont = over _render \render d p s c -> [ div [className "row" ] (render d p s c) ]
as = focus _treeState _treeAction Tree.treeview
bs = innerLayout $ layout
innerLayout :: Spec AppState {} Action
-> Spec AppState {} Action
innerLayout = over _render \render d p s c ->
[ div [_id "page-wrapper"]
[
div [className "container-fluid"] (render d p s c)
]
]
layout1 :: Spec AppState {} Action
-> Spec AppState {} Action
layout1 layout =
fold
[ layoutSidebar divSearchBar
, outerLayout
, layoutFooter
]
where
outerLayout1 = simpleSpec defaultPerformAction defaultRender
outerLayout :: Spec AppState {} Action
outerLayout =
cont $ fold
[ withState \st ->
if ((\(LN.State s) -> s.loginC) st.loginState == true)
then ls as
else outerLayout1
, rs bs
]
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"]
, div [if (s.showTree) then className "col-md-2" else className "col-md-2"] if (s.showTree) then (render d p s c) else []
]
rs = over _render \render d p s c -> [ div [if (s.showTree) then className "col-md-10" else className "col-md-12"] (render d p s c) ]
cont = over _render \render d p s c -> [ div [className "row" ] (render d p s c) ]
as = focus _treeState _treeAction Tree.treeview
......@@ -105,13 +150,14 @@ layout0 layout =
]
]
layoutSidebar :: Spec AppState {} Action
-> Spec AppState {} Action
layoutSidebar = over _render \render d p s c ->
[ div [ _id "dafixedtop"
, className "navbar navbar-inverse navbar-fixed-top"
, role "navigation"
] [ div [className "container"]
] [ div [className "container-fluid"]
[ div [ className "navbar-inner" ]
[ divLogo
, div [ className "collapse navbar-collapse"]
......@@ -282,6 +328,7 @@ divDropdownRight d =
-- else
[text " Login / Signup"]
]
]
layoutFooter :: Spec AppState {} Action
......
......@@ -27,6 +27,7 @@ type AppState =
, showCorpus :: Boolean
, graphExplorerState :: GE.State
, initialized :: Boolean
, showTree :: Boolean
}
initAppState :: AppState
......@@ -43,6 +44,7 @@ initAppState =
, showCorpus : false
, graphExplorerState : GE.initialState
, initialized : false
, showTree : false
}
---------------------------------------------------------
......
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