Skip to content

Commit

Permalink
Variable naming and displaying username, title, and department below …
Browse files Browse the repository at this point in the history
…displayname
  • Loading branch information
Deepalijain13 committed Dec 3, 2024
1 parent 954f6b1 commit fffa18f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ export const EditOwnersModal = ({
const avatarUrl =
(entity.type === EntityType.CorpUser && (entity as CorpUser).editableProperties?.pictureLink) || undefined;
const isCorpUser = (entity.type as EntityType) === EntityType.CorpUser;
const displayCorpUserDepartmentName =
const corpUserDepartmentName =
(entity.type === EntityType.CorpUser && (entity as CorpUser).properties?.departmentName) || '';
const displayCorpUserUserName = (entity.type === EntityType.CorpUser && (entity as CorpUser).username) || '';

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);
const concatenatedValue = isCorpUser
? displayName
.concat(displayCorpUserUserName ? ` - ${displayCorpUserUserName}` : '')
.concat(displayCorpUserDepartmentName ? ` - ${displayCorpUserDepartmentName}` : '')
? `${displayName}\n${corpUserId ? `${corpUserId}` : ''}${corpUserTitle ? ` ${corpUserTitle}` : ''}${
corpUserDepartmentName ? ` ${corpUserDepartmentName}` : ''
}`
: displayName;

return (
Expand Down
9 changes: 8 additions & 1 deletion datahub-web-react/src/app/shared/OwnerLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@ export const OwnerLabel = ({ name, avatarUrl, type }: Props) => {
<OwnerContainerWrapper>
<OwnerContentWrapper>
<CustomAvatar size={24} name={name} photoUrl={avatarUrl} isGroup={type === EntityType.CorpGroup} />
<div>{name}</div>
<div>
{name.split('\n').map((line, index) => (
<span key={index} style={index > 0 ? { color: 'gray' } : {}}>
{line}
<br />
</span>
))}
</div>
</OwnerContentWrapper>
</OwnerContainerWrapper>
);
Expand Down
2 changes: 2 additions & 0 deletions datahub-web-react/src/graphql/search.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ fragment searchResultsWithoutSchemaField on Entity {
fullName
email
departmentName
title
}
info {
active
Expand All @@ -428,6 +429,7 @@ fragment searchResultsWithoutSchemaField on Entity {
fullName
email
departmentName
title
}
editableProperties {
displayName
Expand Down

0 comments on commit fffa18f

Please sign in to comment.