Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
invControl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
JetBrains YouTrack
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KSZK
DevTeam
invControl
Commits
f30b1575
Commit
f30b1575
authored
Dec 13, 2020
by
Rafael László
Browse files
Options
Downloads
Patches
Plain Diff
Group Members list
parent
350045e8
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#5586
passed
Dec 13, 2020
Stage: Build
Stage: Docker build
Stage: Deploy
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
client/src/components/admin/group/GroupMembers.tsx
+94
-3
94 additions, 3 deletions
client/src/components/admin/group/GroupMembers.tsx
with
94 additions
and
3 deletions
client/src/components/admin/group/GroupMembers.tsx
+
94
−
3
View file @
f30b1575
import
{
Group
}
from
'
../../../types/graphqlSchema
'
;
import
{
Box
,
IconButton
,
Tooltip
,
Typography
}
from
'
@material-ui/core
'
;
import
{
Group
,
Member
}
from
'
../../../types/graphqlSchema
'
;
import
{
IListGroupMembers
,
listGroupMembers
}
from
'
../../../graphql/queries/group/listGroupMembers
'
;
import
{
CardTable
}
from
'
../../utils/CardTable
'
;
import
CreateIcon
from
'
@material-ui/icons/Create
'
;
import
PeopleIcon
from
'
@material-ui/icons/People
'
;
import
React
from
'
react
'
;
import
{
getMemberStateString
}
from
'
../../../utils/getMemberStateString
'
;
import
{
useQuery
}
from
'
@apollo/client
'
;
interface
IGroupMembersTable
extends
Partial
<
Member
>
{
name
:
string
;
membership
:
Partial
<
Member
>
;
}
const
convertResponseToTable
=
(
rows
:
Partial
<
Member
>
[]
|
undefined
):
Partial
<
IGroupMembersTable
>
[]
=>
{
if
(
!
rows
)
return
[];
return
rows
.
map
((
o
)
=>
({
name
:
`
${
o
.
user
?.
familyName
}
${
o
.
user
?.
givenName
}
`
,
membership
:
{
groupRole
:
o
.
groupRole
,
memberState
:
o
.
memberState
},
}));
};
interface
TParams
{
group
:
Partial
<
Group
>
|
undefined
;
...
...
@@ -7,6 +28,76 @@ interface TParams {
}
export
const
GroupMembers
:
React
.
FC
<
TParams
>
=
({
group
,
filterBy
})
=>
{
console
.
log
(
group
?.
id
);
return
<>
filtered role =
{
filterBy
||
'
none
'
}
</>;
console
.
log
(
filterBy
);
const
{
loading
:
membersIsLoading
,
data
:
members
}
=
useQuery
<
IListGroupMembers
>
(
listGroupMembers
(
`user { familyName, givenName }, memberState, groupRole`
),
{
variables
:
{
groupId
:
Number
(
group
?.
id
)
},
},
);
return
(
<
CardTable
<
Partial
<
IGroupMembersTable
>>
columns
=
{[
{
title
:
'
Név
'
,
field
:
'
name
'
,
},
{
title
:
'
Tagság
'
,
field
:
'
membership
'
,
align
:
'
right
'
,
render
:
function
renderMembership
(
rowData
)
{
if
(
!
rowData
.
membership
)
{
return
''
;
}
return
getMemberStateString
(
rowData
.
membership
);
},
customSort
:
(
rowData1
,
rowData2
)
=>
{
if
(
!
rowData1
.
membership
||
!
rowData2
.
membership
)
{
return
0
;
}
const
str1
=
getMemberStateString
(
rowData1
.
membership
);
const
str2
=
getMemberStateString
(
rowData2
.
membership
);
if
(
str1
<
str2
)
return
-
1
;
if
(
str1
>
str2
)
return
1
;
return
0
;
},
},
{
align
:
'
left
'
,
render
:
function
renderEditIcon
(
rowData
)
{
return
(
<
Tooltip
title
=
"Szerkesztés"
aria-label
=
"group-administration"
>
<
IconButton
onClick
=
{
()
=>
alert
(
'
Not implemented
'
+
rowData
.
name
)
}
color
=
"secondary"
style
=
{
{
padding
:
'
8px
'
}
}
>
<
CreateIcon
/>
</
IconButton
>
</
Tooltip
>
);
},
width
:
'
8px
'
,
},
]}
data
=
{
convertResponseToTable
(
members
?.
group
.
members
)}
isLoading
=
{
membersIsLoading
}
title
=
{
<
Box
display
=
"
flex
"
alignItems
=
"
center
"
>
<
PeopleIcon
/>
<
Typography
variant
=
"h5"
style
=
{
{
marginLeft
:
'
0.8rem
'
}
}
>
Tagok
</
Typography
>
<
/
Box
>
}
options=
{
{
search
:
true
,
rowStyle
:
{
fontFamily
:
'
Roboto
'
},
emptyRowsWhenPaging
:
false
,
}
}
/>
);
};
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment