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
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Grégoire Locqueville
purescript-gargantext
Commits
9db2c91d
Commit
9db2c91d
authored
Sep 24, 2022
by
Karen Konou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Team] show team leader
parent
46286418
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
24 deletions
+37
-24
ManageTeam.purs
...antext/Components/Forest/Tree/Node/Action/ManageTeam.purs
+23
-18
GraphQL.purs
src/Gargantext/Components/GraphQL.purs
+2
-2
Endpoints.purs
src/Gargantext/Components/GraphQL/Endpoints.purs
+2
-2
Team.purs
src/Gargantext/Components/GraphQL/Team.purs
+10
-2
No files found.
src/Gargantext/Components/Forest/Tree/Node/Action/ManageTeam.purs
View file @
9db2c91d
...
...
@@ -2,13 +2,13 @@ module Gargantext.Components.Forest.Tree.Node.Action.ManageTeam where
import Gargantext.Prelude
import Data.Array (filter, null)
import Data.Array (filter, null
, (:)
)
import Data.Either (Either(..))
import Effect.Aff (runAff_)
import Effect.Class (liftEffect)
import Gargantext.Components.Forest.Tree.Node.Tools as Tools
import Gargantext.Components.GraphQL.Endpoints (deleteTeamMembership, getTeam)
import Gargantext.Components.GraphQL.Team (TeamMember)
import Gargantext.Components.GraphQL.Team (Team
, Team
Member)
import Gargantext.Config.REST (AffRESTError, logRESTError)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Sessions (Session)
...
...
@@ -47,7 +47,7 @@ actionManageTeamCpt = here.component "actionManageTeam" cpt where
type TeamProps =
( nodeId :: ID
, session :: Session
, team ::
(Array TeamMember)
, team ::
Team
)
teamLayoutWrapper :: R2.Component TeamProps
...
...
@@ -55,13 +55,13 @@ teamLayoutWrapper = R.createElement teamLayoutWrapperCpt
teamLayoutWrapperCpt :: R.Component TeamProps
teamLayoutWrapperCpt = here.component "teamLayoutWrapper" cpt where
cpt {nodeId, session, team} _ = do
teamS <- T.useBox team
cpt {nodeId, session, team
: {team_leader_username, team_members}
} _ = do
teamS <- T.useBox team
_members
team' <- T.useLive T.unequal teamS
error <- T.useBox ""
error' <- T.useLive T.unequal error
pure $ teamLayoutRows {nodeId, session, team: teamS, team', error, error'}
pure $ teamLayoutRows {nodeId, session, team: teamS, team', error, error'
, team_leader_username
}
type TeamRowProps =
( nodeId :: ID
...
...
@@ -70,6 +70,7 @@ type TeamRowProps =
, error :: T.Box String
, team' :: Array TeamMember
, error' :: String
, team_leader_username :: String
)
teamLayoutRows :: R2.Leaf TeamRowProps
...
...
@@ -77,12 +78,12 @@ teamLayoutRows = R2.leafComponent teamLayoutRowsCpt
teamLayoutRowsCpt :: R.Component TeamRowProps
teamLayoutRowsCpt = here.component "teamLayoutRows" cpt where
cpt { team, nodeId, session, error, team', error'
} _ = do
cpt { team, nodeId, session, error, team', error'
, team_leader_username
} _ = do
case null team' of
true -> pure $ H.div { style: {margin: "10px"}}
[ H.h4 {} [H.text "Your team is empty, you can send some invitations."]]
false -> pure $ Tools.panel (ma
p makeTeam team'
) (H.div {} [H.text error'])
false -> pure $ Tools.panel (ma
keLeader team_leader_username : (map makeTeam team')
) (H.div {} [H.text error'])
where
makeTeam :: TeamMember -> R.Element
...
...
@@ -94,6 +95,10 @@ teamLayoutRowsCpt = here.component "teamLayoutRows" cpt where
} []
]
makeLeader username = H.div {className: "from-group row"} [ H.div { className: "col-8"} [ H.text username ]
, H.p { className: "col-2"} [ H.text "leader"]
]
submit sharedFolderId _ = do
runAff_ callback $ saveDeleteTeam { session, nodeId, sharedFolderId }
...
...
@@ -118,7 +123,7 @@ type LoadProps =
)
loadTeam :: Record LoadProps -> AffRESTError
(Array TeamMember)
loadTeam :: Record LoadProps -> AffRESTError
Team
loadTeam { session, nodeId } = getTeam session nodeId
type DeleteProps =
...
...
src/Gargantext/Components/GraphQL.purs
View file @
9db2c91d
...
...
@@ -14,7 +14,7 @@ import Gargantext.Components.GraphQL.IMT as GQLIMT
import Gargantext.Components.GraphQL.Node (Node)
import Gargantext.Components.GraphQL.Tree (TreeFirstLevel)
import Gargantext.Components.GraphQL.User (User, UserInfo, UserInfoM)
import Gargantext.Components.GraphQL.Team (Team
Member
, TeamDeleteM)
import Gargantext.Components.GraphQL.Team (Team, TeamDeleteM)
import Gargantext.Ends (Backend(..))
import Gargantext.Sessions (Session(..))
import Gargantext.Utils.Reactix as R2
...
...
@@ -78,7 +78,7 @@ type Schema
, users :: { user_id :: Int } ==> Array User
, tree :: { root_id :: Int } ==> TreeFirstLevel
, annuaire_contacts :: { contact_id :: Int } ==> Array AnnuaireContact
, team :: { team_node_id :: Int } ==>
Array TeamMember
, team :: { team_node_id :: Int } ==>
Team
}
type Mutation
...
...
src/Gargantext/Components/GraphQL/Endpoints.purs
View file @
9db2c91d
...
...
@@ -10,7 +10,7 @@ import Effect.Class (liftEffect)
import Gargantext.Components.GraphQL (getClient, queryGql)
import Gargantext.Components.GraphQL.IMT as GQLIMT
import Gargantext.Components.GraphQL.Node (Node, nodeParentQuery, nodesQuery)
import Gargantext.Components.GraphQL.Team (Team
Member
, teamQuery)
import Gargantext.Components.GraphQL.Team (Team, teamQuery)
import Gargantext.Components.GraphQL.Tree (TreeFirstLevel, treeFirstLevelQuery)
import Gargantext.Components.GraphQL.User (UserInfo, userInfoQuery)
import Gargantext.Config.REST (RESTError(..), AffRESTError)
...
...
@@ -73,7 +73,7 @@ getTreeFirstLevel session id = do
liftEffect $ here.log2 "[getTreeFirstLevel] tree first level" tree
pure $ Right tree -- TODO: error handling
getTeam :: Session -> Int -> AffRESTError
(Array TeamMember)
getTeam :: Session -> Int -> AffRESTError
Team
getTeam session id = do
{ team } <- queryGql session "get team" $ teamQuery `withVars` { id }
liftEffect $ here.log2 "[getTree] data" team
...
...
src/Gargantext/Components/GraphQL/Team.purs
View file @
9db2c91d
...
...
@@ -5,6 +5,11 @@ import Gargantext.Prelude
import GraphQL.Client.Args (NotNull, (=>>))
import GraphQL.Client.Variable (Var(..))
type Team
= { team_leader_username :: String
, team_members :: Array TeamMember
}
type TeamMember
= { username :: String
, shared_folder_id :: Int
...
...
@@ -17,6 +22,9 @@ type TeamDeleteM
}
teamQuery = { team: { team_node_id: Var :: _ "id" Int } =>>
{ username: unit
, shared_folder_id: unit }
{ team_leader_username: unit
, team_members: { username: unit
, shared_folder_id: unit
}
}
}
\ No newline at end of file
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