Skip to content

Commit

Permalink
feat(technical user details): updated technical user details with use…
Browse files Browse the repository at this point in the history
…r type and service endpoint fields. Also, updated copy icon color for better view and made copy icon available only when value is available
  • Loading branch information
lavanya-bmw committed Sep 23, 2024
1 parent ea3ab6e commit 8eb5067
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 31 deletions.
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

### Change

- **Technical User Details**
- updated technical user details with user type and service endpoint fields. Also, updated copy icon color for better view and made copy icon available only when value is available

## 2.2.0-alpha.1

### Bugfixes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import {
type ServiceAccountDetail,
type ServiceAccountRole,
useResetCredentialMutation,
UserType,
} from 'features/admin/serviceApiSlice'
import { OVERLAYS } from 'types/Constants'
import { useDispatch } from 'react-redux'
Expand All @@ -52,11 +51,6 @@ export const statusColorMap: Record<
[ServiceAccountStatus.PENDING_DELETION]: 'pending',
}

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

const getValueWithTooltip = (value: string, tooltipTitle: string) => {
return (
value || (
Expand Down Expand Up @@ -129,10 +123,7 @@ export default function TechnicalUserDetailsContent({
},
{
key: t('content.usermanagement.technicalUser.detailsPage.userType'),
value: getValueWithTooltip(
userTypeMapping[newData.usertype],
missingInformationHint
),
value: getValueWithTooltip(newData.usertype, missingInformationHint),
copy: false,
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import {
ServiceAccountStatus,
ServiceAccountStatusFilter,
useFetchServiceAccountListQuery,
UserType,
} from 'features/admin/serviceApiSlice'
import { useSelector } from 'react-redux'
import { PAGES } from 'types/Constants'
Expand All @@ -45,11 +44,6 @@ 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 @@ -145,7 +139,7 @@ export const TechnicalUserTable = () => {
headerName: t('global.field.userType'),
flex: 1.2,
valueGetter: ({ row }: { row: ServiceAccountListEntry }) =>
userTypeMapping[row.usertype] || '-',
row.usertype || '-',
},
{
field: 'offer',
Expand Down
17 changes: 10 additions & 7 deletions src/components/shared/basic/KeyValueView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ export const KeyValueView = ({
sx={{
cursor: 'pointer',
display: 'flex',
color: copied === item.value ? '#00cc00' : '#eeeeee',
color: copied === item.value ? '#00cc00' : '#888888',
':hover': {
color: copied === item.value ? '#00cc00' : '#cccccc',
color: copied === item.value ? '#00cc00' : '#0088CC',
},
}}
onClick={async () => {
Expand All @@ -85,11 +85,14 @@ export const KeyValueView = ({
}}
>
{renderValue(item.value ?? '')}
<ContentCopyIcon
sx={{
marginLeft: '10px',
}}
/>
{item.value && (
<ContentCopyIcon
sx={{
marginLeft: '10px',
fontSize: '18px',
}}
/>
)}
</Box>
) : (
<Box sx={{ marginRight: '34px', textAlign: 'left' }}>
Expand Down
9 changes: 2 additions & 7 deletions src/features/admin/serviceApiSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,13 @@ 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
usertype: string
offer?: {
name?: string
}
Expand All @@ -84,7 +79,7 @@ export interface ServiceAccountDetail extends ServiceAccountListEntry {
connector: ConnectedObject
offer: ConnectedObject
companyServiceAccountTypeId: companyServiceAccountType
usertype: UserType
usertype: string
authenticationServiceUrl: string
}

Expand Down

0 comments on commit 8eb5067

Please sign in to comment.