Skip to content

Commit

Permalink
feat(ui): Enhancements to the user pic list selection within entities (
Browse files Browse the repository at this point in the history
  • Loading branch information
Deepalijain13 authored Jan 17, 2025
1 parent 4a1fff5 commit fb08919
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,26 @@ export const EditOwnersModal = ({
const renderSearchResult = (entity: Entity) => {
const avatarUrl =
(entity.type === EntityType.CorpUser && (entity as CorpUser).editableProperties?.pictureLink) || undefined;
const corpUserDepartmentName =
(entity.type === EntityType.CorpUser && (entity as CorpUser).properties?.departmentName) || '';
const corpUserId = (entity.type === EntityType.CorpUser && (entity as CorpUser).username) || '';
const corpUserTitle = (entity.type === EntityType.CorpUser && (entity as CorpUser).properties?.title) || '';
const displayName = entityRegistry.getDisplayName(entity.type, entity);

return (
<Select.Option value={entity.urn} key={entity.urn}>
<OwnerLabel name={displayName} avatarUrl={avatarUrl} type={entity.type} />
<Select.Option
key={entity.urn}
value={entity.urn}
label={<OwnerLabel name={displayName} avatarUrl={avatarUrl} type={entity.type} />}
>
<OwnerLabel
name={displayName}
avatarUrl={avatarUrl}
type={entity.type}
corpUserId={corpUserId}
corpUserTitle={corpUserTitle}
corpUserDepartmentName={corpUserDepartmentName}
/>
</Select.Option>
);
};
Expand Down Expand Up @@ -381,6 +397,7 @@ export const EditOwnersModal = ({
value: owner.value.ownerUrn,
label: owner.label,
}))}
optionLabelProp="label"
>
{ownerSearchOptions}
</SelectInput>
Expand Down
12 changes: 10 additions & 2 deletions datahub-web-react/src/app/shared/OwnerLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,22 @@ type Props = {
name: string;
avatarUrl: string | undefined;
type: EntityType;
corpUserId?: string;
corpUserTitle?: string;
corpUserDepartmentName?: string;
};

export const OwnerLabel = ({ name, avatarUrl, type }: Props) => {
export const OwnerLabel = ({ name, avatarUrl, type, corpUserId, corpUserTitle, corpUserDepartmentName }: Props) => {
const subHeader = [corpUserId, corpUserTitle, corpUserDepartmentName].filter(Boolean).join(' - ');

return (
<OwnerContainerWrapper>
<OwnerContentWrapper>
<CustomAvatar size={24} name={name} photoUrl={avatarUrl} isGroup={type === EntityType.CorpGroup} />
<div>{name}</div>
<div>
<div>{name}</div>
{subHeader && <div style={{ color: 'gray' }}>{subHeader}</div>}
</div>
</OwnerContentWrapper>
</OwnerContainerWrapper>
);
Expand Down
4 changes: 4 additions & 0 deletions datahub-web-react/src/graphql/search.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,8 @@ fragment searchResultsWithoutSchemaField on Entity {
lastName
fullName
email
departmentName
title
}
info {
active
Expand All @@ -442,6 +444,8 @@ fragment searchResultsWithoutSchemaField on Entity {
lastName
fullName
email
departmentName
title
}
editableProperties {
displayName
Expand Down

0 comments on commit fb08919

Please sign in to comment.