Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Usertype column to technical user management list #1090

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/assets/locales/de/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -2327,7 +2327,9 @@
"alias": "Alias",
"authMethod": "Auth Method",
"progress": "Progress",
"action": "Action"
"action": "Action",
"ownership": "Ownership",
"userType": "Usertype"
},
"actions": {
"cancel": "Abbrechen",
Expand Down
4 changes: 3 additions & 1 deletion src/assets/locales/en/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -2302,7 +2302,9 @@
"alias": "Alias",
"authMethod": "Auth Method",
"progress": "Progress",
"action": "Action"
"action": "Action",
"ownership": "Ownership",
"userType": "Usertype"
},
"actions": {
"cancel": "Cancel",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
ServiceAccountStatus,
ServiceAccountStatusFilter,
useFetchServiceAccountListQuery,
UserType,
} from 'features/admin/serviceApiSlice'
import { useSelector } from 'react-redux'
import { PAGES } from 'types/Constants'
Expand All @@ -50,6 +51,11 @@ type StatusTagColor =
| 'deleted'
| undefined

const userTypeMapping = {
[UserType.INTERNAL]: 'INTERNAL',
[UserType.EXTERNAL]: 'EXTERNAL',
}

export const TechnicalUserTable = () => {
const { t } = useTranslation()
const navigate = useNavigate()
Expand Down Expand Up @@ -128,36 +134,43 @@ export const TechnicalUserTable = () => {
{
field: 'name',
headerName: t('global.field.userName'),
flex: 2,
flex: 1.8,
},
{
field: 'clientId',
headerName: t('global.field.clientId'),
flex: 1,
flex: 1.1,
},
{
field: 'serviceAccountType',
headerName: t('global.field.type'),
headerName: t('global.field.ownership'),
flex: 1.15,
},
{
field: 'usertype',
headerName: t('global.field.userType'),
flex: 1.2,
valueGetter: ({ row }: { row: ServiceAccountListEntry }) =>
userTypeMapping[row.usertype] || '-',
},
{
field: 'offer',
headerName: t('global.field.offerLink'),
flex: 1.5,
flex: 1.2,
valueGetter: ({ row }: { row: ServiceAccountListEntry }) =>
row.offer ? row.offer?.name : '',
},
{
field: 'isOwner',
headerName: t('global.field.owner'),
flex: 0.8,
flex: 0.9,
valueGetter: ({ row }: { row: ServiceAccountListEntry }) =>
row.isOwner ? 'Yes' : 'No',
},
{
field: 'status',
headerName: t('global.field.status'),
flex: 1.2,
flex: 1.25,
renderCell: ({ row }: { row: ServiceAccountListEntry }) => (
<StatusTag
color={statusColorMap[row.status]}
Expand All @@ -170,7 +183,7 @@ export const TechnicalUserTable = () => {
{
field: 'details',
headerName: t('global.field.details'),
flex: 1,
flex: 0.9,
renderCell: ({ row }: { row: ServiceAccountListEntry }) => (
<>
<IconButton
Expand Down
5 changes: 5 additions & 0 deletions src/features/admin/serviceApiSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,17 @@ export enum ServiceAccountStatus {
PENDING_DELETION = 'PENDING_DELETION',
}

export enum UserType {
INTERNAL = 'internal',
EXTERNAL = 'external',
}
export interface ServiceAccountListEntry {
serviceAccountId: string
clientId: string
name: string
status: ServiceAccountStatus
isOwner?: boolean
usertype: UserType
offer?: {
name?: string
}
Expand Down
Loading