From 50de06b0e29e4feca587987148905609f49d0248 Mon Sep 17 00:00:00 2001 From: kunalgaurav-bmw Date: Mon, 26 Aug 2024 18:14:21 +0530 Subject: [PATCH] fix(IDP-management): fix status color (#978) --- CHANGELOG.md | 5 +++++ src/components/pages/IDPManagement/IDPList.tsx | 17 ++++++++++++++++- src/features/admin/idpApiSlice.ts | 7 +++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c9322f3a1..5797ed822 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## Unreleased +### Bugfixes + +- **IDP management** + - Fixed statusTag color in status coloumn [#978](https://github.com/eclipse-tractusx/portal-frontend/pull/978) + ### Feature - Customer Detail Data Overlay diff --git a/src/components/pages/IDPManagement/IDPList.tsx b/src/components/pages/IDPManagement/IDPList.tsx index 567b2051a..b6ac8b89c 100644 --- a/src/components/pages/IDPManagement/IDPList.tsx +++ b/src/components/pages/IDPManagement/IDPList.tsx @@ -37,12 +37,15 @@ import { OVERLAYS } from 'types/Constants' import { error, success } from 'services/NotifyService' import { type IdentityProvider, + IdpAccountStatus, useEnableIDPMutation, useFetchIDPListQuery, useRemoveIDPMutation, IDPCategory, } from 'features/admin/idpApiSlice' +type StatusTagColor = 'pending' | 'confirmed' | 'declined' | undefined + const MenuItemOpenOverlay = ({ overlay, id, @@ -126,6 +129,13 @@ export const IDPList = () => { } } + const statusColorMap: Record = { + [IdpAccountStatus.ACTIVE]: 'confirmed', + [IdpAccountStatus.DISABLED]: 'declined', + [IdpAccountStatus.OPEN]: 'pending', + [IdpAccountStatus.IDP_CREATED]: 'pending', + } + const getStatus = (enabled: boolean, clientId: string | undefined) => { let status = `${ti('field.status1')}` if (enabled && !clientId) { @@ -135,7 +145,12 @@ export const IDPList = () => { } else if (enabled && clientId) { status = `${ti('field.status4')}` } - return + return ( + + ) } const renderMenu = (idp: IdentityProvider) => { diff --git a/src/features/admin/idpApiSlice.ts b/src/features/admin/idpApiSlice.ts index e86514ea9..413f40b84 100644 --- a/src/features/admin/idpApiSlice.ts +++ b/src/features/admin/idpApiSlice.ts @@ -61,6 +61,13 @@ export enum SAMLAuthMethod { SECRET = 'SECRET', } +export enum IdpAccountStatus { + ACTIVE = 'active', + OPEN = 'open', + IDP_CREATED = 'Idp created', + DISABLED = 'disabled', +} + export interface IDPMapperConfig { syncMode: IDPSyncModeType }