Commit 208bdfdf authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge remote-tracking branch 'origin/382-dev-plane-navigation' into dev-merge

parents 36df4cc8 38615b10
This diff is collapsed.
......@@ -71,6 +71,7 @@ queryGql session name q = do
-- Schema
type Schema
= { imt_schools :: {} ==> Array GQLIMT.School
, nodes :: { node_id :: Int } ==> Array Node
, node_parent :: { node_id :: Int, parent_type :: String } ==> Array Node -- TODO: parent_type :: NodeType
, user_infos :: { user_id :: Int } ==> Array UserInfo
, users :: { user_id :: Int } ==> Array User
......
......@@ -2,7 +2,7 @@ module Gargantext.Components.GraphQL.Endpoints where
import Gargantext.Prelude
import Gargantext.Components.GraphQL.Node (Node, nodeParentQuery)
import Gargantext.Components.GraphQL.Node (Node, nodeParentQuery, nodesQuery)
import Gargantext.Components.GraphQL.Tree (TreeFirstLevel, treeFirstLevelQuery)
import Gargantext.Components.GraphQL.User (UserInfo, userInfoQuery)
......@@ -30,6 +30,15 @@ getIMTSchools session = do
liftEffect $ here.log2 "[getIMTSchools] imt_schools" imt_schools
pure $ Right imt_schools
getNode :: Session -> Int -> AffRESTError Node
getNode session nodeId = do
{ nodes } <- queryGql session "get nodes" $
nodesQuery `withVars` { id: nodeId }
liftEffect $ here.log2 "[getNode] node" nodes
pure $ case A.head nodes of
Nothing -> Left (CustomError $ "node with id" <> show nodeId <>" not found")
Just node -> Right node
getNodeParent :: Session -> Int -> NodeType -> Aff (Array Node)
getNodeParent session nodeId parentType = do
{ node_parent } <- queryGql session "get node parent" $
......
......@@ -11,6 +11,7 @@ type TreeNode =
{ name :: String
, id :: Int
, node_type :: NodeType
, parent_id :: Maybe Int
}
type TreeFirstLevel =
{ root :: TreeNode
......@@ -22,14 +23,17 @@ treeFirstLevelQuery = { tree: { root_id: Var :: _ "id" Int} =>>
{ root: { name: unit
, node_type: unit
, id: unit
, parent_id: unit
}
, children: { name: unit
, node_type: unit
, id: unit
, parent_id: unit
}
, parent: { name: unit
, node_type: unit
, id: unit
, parent_id: unit
}
}
}
......@@ -68,20 +68,22 @@ corpusLayoutMainCpt = here.component "corpusLayoutMain" cpt
pure $ GR.CorpusCode (sessionId session) nodeId
-- Render
pure $
H.div {}
[
tileMenu
{ boxes
, currentTile: Just corpusCodeRoute
, xTile: Just corpusCodeRoute
, yTile: Just corpusCodeRoute
}
[
H.button
{ className: "btn btn-primary" }
R2.row [
FV.backButtonSmart { nodeId, session } []
, tileMenu
{ boxes
, currentTile: Just corpusCodeRoute
, xTile: Just corpusCodeRoute
, yTile: Just corpusCodeRoute
}
[
H.i { className: "fa fa-code" } []
H.button
{ className: "btn btn-primary" }
[
H.i { className: "fa fa-code" } []
]
]
]
,
......
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