Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nomad-gui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nomad-lab
nomad-gui
Commits
1942954d
Commit
1942954d
authored
5 months ago
by
Sascha Klawohn
Browse files
Options
Downloads
Patches
Plain Diff
Add Role column to GroupsTable
parent
f4521e99
No related branches found
No related tags found
1 merge request
!99
Groups dashboard
Pipeline
#231942
failed
5 months ago
Stage: install
Stage: build
Stage: test
Stage: release
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/pages/groups/GroupsTable.tsx
+31
-7
31 additions, 7 deletions
src/pages/groups/GroupsTable.tsx
with
31 additions
and
7 deletions
src/pages/groups/GroupsTable.tsx
+
31
−
7
View file @
1942954d
import
{
useMemo
}
from
'
react
'
import
{
useMemo
}
from
'
react
'
import
{
useAuth
}
from
'
react-oidc-context
'
import
useRoute
from
'
../../components/routing/useRoute
'
import
useRoute
from
'
../../components/routing/useRoute
'
import
useRouteData
from
'
../../components/routing/useRouteData
'
import
useRouteData
from
'
../../components/routing/useRouteData
'
import
{
ColumnDef
}
from
'
../../components/table/ControlledDataTable
'
import
{
ColumnDef
}
from
'
../../components/table/ControlledDataTable
'
...
@@ -9,7 +10,19 @@ import Text from '../../components/values/primitives/Text'
...
@@ -9,7 +10,19 @@ import Text from '../../components/values/primitives/Text'
import
{
GroupResponse
}
from
'
../../models/graphResponseModels
'
import
{
GroupResponse
}
from
'
../../models/graphResponseModels
'
import
groupsRoute
from
'
./groupsRoute
'
import
groupsRoute
from
'
./groupsRoute
'
function
getUserRole
(
group
:
GroupResponse
,
userId
:
string
|
null
|
undefined
)
{
if
(
group
?.
owner
?.
user_id
===
userId
)
{
return
'
Owner
'
}
else
if
(
group
?.
members
?.
some
((
member
)
=>
member
.
user_id
===
userId
))
{
return
'
Member
'
}
else
{
return
null
}
}
export
function
GroupsTable
()
{
export
function
GroupsTable
()
{
const
{
user
}
=
useAuth
()
const
{
navigate
}
=
useRoute
()
const
{
navigate
}
=
useRoute
()
const
data
=
useRouteData
(
groupsRoute
)
const
data
=
useRouteData
(
groupsRoute
)
...
@@ -27,26 +40,37 @@ export function GroupsTable() {
...
@@ -27,26 +40,37 @@ export function GroupsTable() {
accessorKey
:
'
group_name
'
,
accessorKey
:
'
group_name
'
,
header
:
'
Name
'
,
header
:
'
Name
'
,
Cell
:
({
cell
})
=>
<
Text
value
=
{
cell
.
getValue
<
string
>
()
}
fullWidth
/>,
Cell
:
({
cell
})
=>
<
Text
value
=
{
cell
.
getValue
<
string
>
()
}
fullWidth
/>,
},
grow
:
true
,
{
accessorKey
:
'
group_id
'
,
header
:
'
ID
'
,
Cell
:
({
cell
})
=>
<
Id
value
=
{
cell
.
getValue
<
string
>
()
}
abbreviated
/>,
},
},
{
{
accessorKey
:
'
owner.name
'
,
accessorKey
:
'
owner.name
'
,
header
:
'
Owner
'
,
header
:
'
Owner
'
,
Cell
:
({
cell
})
=>
<
Text
value
=
{
cell
.
getValue
<
string
>
()
}
/>,
Cell
:
({
cell
})
=>
<
Text
value
=
{
cell
.
getValue
<
string
>
()
}
/>,
grow
:
true
,
},
{
header
:
'
Role
'
,
accessorFn
:
(
data
)
=>
getUserRole
(
data
,
user
?.
profile
.
sub
),
Cell
:
({
cell
})
=>
<
Text
value
=
{
cell
.
getValue
<
string
>
()
}
/>,
grow
:
true
,
},
},
{
{
id
:
'
members
'
,
id
:
'
members
'
,
accessorFn
:
(
data
)
=>
data
?.
members
?.
length
||
'
0
'
,
accessorFn
:
(
data
)
=>
data
?.
members
?.
length
||
'
0
'
,
header
:
'
Members
'
,
header
:
'
Members
'
,
grow
:
true
,
Cell
:
({
cell
})
=>
<
Text
value
=
{
cell
.
getValue
<
string
>
()
}
/>,
Cell
:
({
cell
})
=>
<
Text
value
=
{
cell
.
getValue
<
string
>
()
}
/>,
center
:
true
,
grow
:
true
,
foo
:
'
bar
'
,
},
{
accessorKey
:
'
group_id
'
,
header
:
'
ID
'
,
Cell
:
({
cell
})
=>
<
Id
value
=
{
cell
.
getValue
<
string
>
()
}
abbreviated
/>,
grow
:
true
,
},
},
],
],
[],
[
user
?.
profile
.
sub
],
)
)
return
(
return
(
...
...
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