Skip to content

Commit

Permalink
Merge pull request #1104 from gchq/feature/BAI-1175-add-user-display-…
Browse files Browse the repository at this point in the history
…to-access-request

added user display component to entity selector
  • Loading branch information
ARADDCC002 authored Feb 19, 2024
2 parents 26c65b7 + 42099f5 commit 9779d84
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions frontend/src/MuiForms/EntitySelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import TextField from '@mui/material/TextField'
import { FormContextType } from '@rjsf/utils'
import { debounce } from 'lodash-es'
import { KeyboardEvent, SyntheticEvent, useCallback, useEffect, useMemo, useState } from 'react'
import UserDisplay from 'src/common/UserDisplay'
import { EntityObject } from 'types/types'

import { useGetCurrentUser, useListUsers } from '../../actions/user'
Expand Down Expand Up @@ -98,7 +99,11 @@ export default function EntitySelector(props: EntitySelectorProps) {
renderTags={(value, getTagProps) =>
value.map((option, index) => (
<Box key={option.id} sx={{ maxWidth: '200px' }}>
<Chip {...getTagProps({ index })} sx={{ textOverflow: 'ellipsis' }} label={option.id} />
<Chip
{...getTagProps({ index })}
sx={{ textOverflow: 'ellipsis' }}
label={<UserDisplay dn={option.id} />}
/>
</Box>
))
}
Expand Down Expand Up @@ -135,7 +140,7 @@ export default function EntitySelector(props: EntitySelectorProps) {
<Box sx={{ overflowX: 'auto', p: 1 }}>
<Stack spacing={1} direction='row'>
{currentValue.map((entity) => (
<Chip label={entity.split(':')[1] || entity} key={entity} sx={{ width: 'fit-content' }} />
<Chip label={<UserDisplay dn={entity} />} key={entity} sx={{ width: 'fit-content' }} />
))}
</Stack>
</Box>
Expand Down

0 comments on commit 9779d84

Please sign in to comment.