Skip to content

Commit

Permalink
feat: add Usertype column to technical user management list (#1090)
Browse files Browse the repository at this point in the history
  • Loading branch information
shahmargi12 authored Sep 17, 2024
1 parent 90542d2 commit 531f6fb
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 9 deletions.
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 @@ -44,6 +45,11 @@ interface FetchHookArgsType {
}
type StatusTagColor = 'pending' | 'confirmed' | 'label' | undefined

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

export const TechnicalUserTable = () => {
const { t } = useTranslation()
const navigate = useNavigate()
Expand Down Expand Up @@ -122,36 +128,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 @@ -164,7 +177,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 @@ -54,12 +54,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

0 comments on commit 531f6fb

Please sign in to comment.