Skip to content

Commit

Permalink
fix(IDP-management): fix status color (#978)
Browse files Browse the repository at this point in the history
  • Loading branch information
kunalgaurav-bmw authored Aug 26, 2024
1 parent aae4195 commit 50de06b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 16 additions & 1 deletion src/components/pages/IDPManagement/IDPList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -126,6 +129,13 @@ export const IDPList = () => {
}
}

const statusColorMap: Record<IdpAccountStatus, StatusTagColor> = {
[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) {
Expand All @@ -135,7 +145,12 @@ export const IDPList = () => {
} else if (enabled && clientId) {
status = `${ti('field.status4')}`
}
return <StatusTag color="label" label={status} />
return (
<StatusTag
color={statusColorMap[status as IdpAccountStatus]}
label={status}
/>
)
}

const renderMenu = (idp: IdentityProvider) => {
Expand Down
7 changes: 7 additions & 0 deletions src/features/admin/idpApiSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 50de06b

Please sign in to comment.