Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
142
Issues
142
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
purescript-gargantext
Commits
08c8d76c
Commit
08c8d76c
authored
Jul 18, 2022
by
Karen Konou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[WIP] team loader
parent
12d7ffb8
Pipeline
#3031
failed with stage
in 0 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
7 deletions
+57
-7
Endpoints.purs
src/Gargantext/Components/GraphQL/Endpoints.purs
+2
-4
Team.purs
src/Gargantext/Components/Nodes/Team.purs
+55
-3
No files found.
src/Gargantext/Components/GraphQL/Endpoints.purs
View file @
08c8d76c
...
...
@@ -73,13 +73,11 @@ getTreeFirstLevel session id = do
liftEffect $ here.log2 "[getTreeFirstLevel] tree first level" tree
pure $ Right tree -- TODO: error handling
getTeam :: Session -> Int -> AffRESTError
TeamMember
getTeam :: Session -> Int -> AffRESTError
(Array TeamMember)
getTeam session id = do
{ team } <- queryGql session "get team" $ teamQuery `withVars` { id }
liftEffect $ here.log2 "[getTree] data" team
pure $ case A.head team of
Nothing -> Left (CustomError $ "team node id=" <> show id <> " not found")
Just t -> Right t
pure $ Right team
type SharedFolderId = Int
type TeamNodeId = Int
...
...
src/Gargantext/Components/Nodes/Team.purs
View file @
08c8d76c
...
...
@@ -3,7 +3,12 @@ module Gargantext.Components.Nodes.Team where
import Gargantext.Prelude
import Gargantext.Components.App.Store (Boxes)
import Gargantext.Sessions (Session(..))
import Gargantext.Components.FolderView as FV
import Gargantext.Components.GraphQL.Team (TeamMember)
import Gargantext.Components.GraphQL.Endpoints (getTeam)
import Gargantext.Config.REST (AffRESTError, logRESTError)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Sessions (Session)
import Gargantext.Types (ID)
import Gargantext.Utils.Reactix as R2
import Reactix as R
...
...
@@ -22,5 +27,52 @@ teamLayout = R2.leafComponent teamLayoutCpt
teamLayoutCpt :: R.Component Props
teamLayoutCpt = here.component "teamLayout" cpt where
cpt _ _ = do
pure $ H.text "todo"
cpt props _ = do
pure $ R.fragment [
FV.folderView props
, teamLayoutMain props
]
teamLayoutMain :: R2.Leaf Props
teamLayoutMain = R2.leafComponent teamLayoutMainCpt
teamLayoutMainCpt :: R.Component Props
teamLayoutMainCpt = here.component "teamLayoutMain" cpt where
cpt { nodeId, session, boxes } _ = do
useLoader { errorHandler
, loader: loadTeam
, path: { nodeId, session }
, render: \team -> teamLayoutRows { boxes
, team
, nodeId
, session
}
}
where
errorHandler = logRESTError here "teamLayout"
type TeamProps =
( boxes :: Boxes
, nodeId :: ID
, session :: Session
, team :: Array TeamMember )
teamLayoutRows :: R2.Leaf TeamProps
teamLayoutRows = R2.leafComponent teamLayoutRowsCpt
teamLayoutRowsCpt :: R.Component TeamProps
teamLayoutRowsCpt = here.component "teamLayoutRows" cpt where
cpt { team } _ = do
pure $ H.div {} $ map makeTeam team
where
makeTeam { username } = H.p {} [H.text username]
type LoadProps =
(
session :: Session,
nodeId :: Int
)
loadTeam :: Record LoadProps -> AffRESTError (Array TeamMember)
loadTeam { session, nodeId } = getTeam session nodeId
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment