Skip to content

Commit

Permalink
feat: enhance technical user detail with status, auth type and servic…
Browse files Browse the repository at this point in the history
…e account type
  • Loading branch information
shahmargi12 committed Aug 23, 2024
1 parent 194a81c commit 36a2cfb
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
]
},
"dependencies": {
"@catena-x/portal-shared-components": "^3.0.29",
"@catena-x/portal-shared-components": "^3.2.0",
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@hookform/error-message": "^2.0.1",
Expand Down
4 changes: 3 additions & 1 deletion src/assets/locales/de/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,9 @@
"userDetails": "Technischer Benutzer Details",
"description": "Beschreibung",
"spoc": "SPOC",
"permission": "Berechtigungen"
"permission": "Berechtigungen",
"companyServiceAccountTypeID": "Firmenservicekontotyp",
"authenticationType": "Authentifizierungstyp"
},
"status": {
"ACTIVE": "AKTIV",
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 @@ -925,7 +925,9 @@
"userDetails": "Technical User Details",
"description": "Description",
"spoc": "SPOC",
"permission": "Permission"
"permission": "Permission",
"companyServiceAccountTypeID": "Company Service Account Type",
"authenticationType": "Authentication Type"
},
"status": {
"ACTIVE": "ACTIVE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

import { Button, CircleProgress } from '@catena-x/portal-shared-components'
import {
Button,
CircleProgress,
StatusTag,
} from '@catena-x/portal-shared-components'
import { useTranslation } from 'react-i18next'
import { Box } from '@mui/material'
import HighlightOffIcon from '@mui/icons-material/HighlightOff'
Expand All @@ -32,8 +36,20 @@ import { useDispatch } from 'react-redux'
import { show } from 'features/control/overlay'
import { KeyValueView } from 'components/shared/basic/KeyValueView'
import SyncIcon from '@mui/icons-material/Sync'
import { useState } from 'react'
import { type ComponentProps, useState } from 'react'
import { error, success } from 'services/NotifyService'
import { ServiceAccountStatus } from 'features/admin/serviceApiSlice'

export const statusColorMap: Record<
ServiceAccountStatus,
ComponentProps<typeof StatusTag>['color']
> = {
[ServiceAccountStatus.ACTIVE]: 'confirmed',
[ServiceAccountStatus.INACTIVE]: 'declined',
[ServiceAccountStatus.DELETED]: 'deleted',
[ServiceAccountStatus.PENDING]: 'pending',
[ServiceAccountStatus.PENDING_DELETION]: 'pending',
}

export default function TechnicalUserDetailsContent({
data,
Expand All @@ -59,6 +75,16 @@ export default function TechnicalUserDetailsContent({
]

const displayData = [
{
key: t('global.field.status'),
value: (
<StatusTag
color={statusColorMap[newData?.status]}
label={newData?.status}
/>
),
copy: false,
},
{
key: 'ID',
value: newData.serviceAccountId,
Expand All @@ -71,13 +97,22 @@ export default function TechnicalUserDetailsContent({
value: newData.name,
copy: true,
},
{
key: t(
'content.usermanagement.technicalUser.detailsPage.companyServiceAccountTypeID'
),
value: newData.companyServiceAccountTypeId,
copy: false,
},
{
key: t('global.field.clientId'),
value: newData.clientId,
copy: true,
},
{
key: t('global.field.authType'),
key: t(
'content.usermanagement.technicalUser.detailsPage.authenticationType'
),
value: newData.authenticationType,
},
{
Expand Down
6 changes: 6 additions & 0 deletions src/features/admin/serviceApiSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export interface ServiceAccountDetail extends ServiceAccountListEntry {
roles: ServiceAccountRole[]
connector: ConnectedObject
offer: ConnectedObject
companyServiceAccountTypeId: companyServiceAccountType
}

export type AppRoleCreate = {
Expand All @@ -103,6 +104,11 @@ export enum ServiceAccountStatusFilter {
OWNED = 'OWNED',
}

export enum companyServiceAccountType {
MANAGED = 'MANAGED',
OWNED = 'OWN',
}

export const apiSlice = createApi({
reducerPath: 'rtk/admin/service',
baseQuery: fetchBaseQuery(apiBaseQuery()),
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,10 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==

"@catena-x/portal-shared-components@^3.0.29":
version "3.0.29"
resolved "https://registry.yarnpkg.com/@catena-x/portal-shared-components/-/portal-shared-components-3.0.29.tgz#85f83ce4a3d7b8d19c9719af9cd138a93070269a"
integrity sha512-VFzU+Krmt6doZWPLMn91FvqTXbF/bACKkdm7e+cAyGkiarTs4hL1iv4wjtgwSp/Uq0qZUKBL46N6Ouxyw5p3iQ==
"@catena-x/portal-shared-components@^3.2.0":
version "3.2.0"
resolved "https://registry.yarnpkg.com/@catena-x/portal-shared-components/-/portal-shared-components-3.2.0.tgz#dcf4b3c4b3c2576801d6c3d9cb5f85ce8a2635d6"
integrity sha512-uy2jgIcGBcbWsg0MBN44b3W0MM6ZXrdmN5YeObGq9PW6D4fiGJviCGbqw12u0Zm20dNgchoCquArkJaSnv1uTw==
dependencies:
"@date-io/date-fns" "^3.0.0"
"@emotion/react" "^11.11.4"
Expand Down

0 comments on commit 36a2cfb

Please sign in to comment.