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 ...@@ -71,6 +71,7 @@ queryGql session name q = do
-- Schema -- Schema
type Schema type Schema
= { imt_schools :: {} ==> Array GQLIMT.School = { 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 , node_parent :: { node_id :: Int, parent_type :: String } ==> Array Node -- TODO: parent_type :: NodeType
, user_infos :: { user_id :: Int } ==> Array UserInfo , user_infos :: { user_id :: Int } ==> Array UserInfo
, users :: { user_id :: Int } ==> Array User , users :: { user_id :: Int } ==> Array User
......
...@@ -2,7 +2,7 @@ module Gargantext.Components.GraphQL.Endpoints where ...@@ -2,7 +2,7 @@ module Gargantext.Components.GraphQL.Endpoints where
import Gargantext.Prelude 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.Tree (TreeFirstLevel, treeFirstLevelQuery)
import Gargantext.Components.GraphQL.User (UserInfo, userInfoQuery) import Gargantext.Components.GraphQL.User (UserInfo, userInfoQuery)
...@@ -30,6 +30,15 @@ getIMTSchools session = do ...@@ -30,6 +30,15 @@ getIMTSchools session = do
liftEffect $ here.log2 "[getIMTSchools] imt_schools" imt_schools liftEffect $ here.log2 "[getIMTSchools] imt_schools" imt_schools
pure $ Right 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 -> Int -> NodeType -> Aff (Array Node)
getNodeParent session nodeId parentType = do getNodeParent session nodeId parentType = do
{ node_parent } <- queryGql session "get node parent" $ { node_parent } <- queryGql session "get node parent" $
......
...@@ -11,6 +11,7 @@ type TreeNode = ...@@ -11,6 +11,7 @@ type TreeNode =
{ name :: String { name :: String
, id :: Int , id :: Int
, node_type :: NodeType , node_type :: NodeType
, parent_id :: Maybe Int
} }
type TreeFirstLevel = type TreeFirstLevel =
{ root :: TreeNode { root :: TreeNode
...@@ -22,14 +23,17 @@ treeFirstLevelQuery = { tree: { root_id: Var :: _ "id" Int} =>> ...@@ -22,14 +23,17 @@ treeFirstLevelQuery = { tree: { root_id: Var :: _ "id" Int} =>>
{ root: { name: unit { root: { name: unit
, node_type: unit , node_type: unit
, id: unit , id: unit
, parent_id: unit
} }
, children: { name: unit , children: { name: unit
, node_type: unit , node_type: unit
, id: unit , id: unit
, parent_id: unit
} }
, parent: { name: unit , parent: { name: unit
, node_type: unit , node_type: unit
, id: unit , id: unit
, parent_id: unit
} }
} }
} }
...@@ -68,10 +68,11 @@ corpusLayoutMainCpt = here.component "corpusLayoutMain" cpt ...@@ -68,10 +68,11 @@ corpusLayoutMainCpt = here.component "corpusLayoutMain" cpt
pure $ GR.CorpusCode (sessionId session) nodeId pure $ GR.CorpusCode (sessionId session) nodeId
-- Render -- Render
pure $ pure $
H.div {} H.div {}
[ [
tileMenu R2.row [
FV.backButtonSmart { nodeId, session } []
, tileMenu
{ boxes { boxes
, currentTile: Just corpusCodeRoute , currentTile: Just corpusCodeRoute
, xTile: Just corpusCodeRoute , xTile: Just corpusCodeRoute
...@@ -84,6 +85,7 @@ corpusLayoutMainCpt = here.component "corpusLayoutMain" cpt ...@@ -84,6 +85,7 @@ corpusLayoutMainCpt = here.component "corpusLayoutMain" cpt
H.i { className: "fa fa-code" } [] H.i { className: "fa fa-code" } []
] ]
] ]
]
, ,
H.hr {} H.hr {}
, ,
......
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