From 8457b947e311460124dda89b41e58c850b1e0f69 Mon Sep 17 00:00:00 2001 From: kanavnarula <33712591+kanavnarula@users.noreply.github.com> Date: Fri, 30 Aug 2024 13:31:22 +0530 Subject: [PATCH 01/14] Advance search - Added case sensitive flag for CONTAINS --- .../main/java/com/linkedin/metadata/search/utils/ESUtils.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/metadata-io/src/main/java/com/linkedin/metadata/search/utils/ESUtils.java b/metadata-io/src/main/java/com/linkedin/metadata/search/utils/ESUtils.java index c4060bbb0928b..4f854f7468b70 100644 --- a/metadata-io/src/main/java/com/linkedin/metadata/search/utils/ESUtils.java +++ b/metadata-io/src/main/java/com/linkedin/metadata/search/utils/ESUtils.java @@ -558,7 +558,8 @@ private static QueryBuilder getQueryBuilderFromCriterionForSingleField( return QueryBuilders.wildcardQuery( toKeywordField(criterion.getField(), isTimeseries, aspectRetriever), "*" + ESUtils.escapeReservedCharacters(criterion.getValue().trim()) + "*") - .queryName(queryName != null ? queryName : fieldName); + .queryName(queryName != null ? queryName : fieldName) + .caseInsensitive(true); } else if (condition == Condition.START_WITH) { return QueryBuilders.wildcardQuery( toKeywordField(criterion.getField(), isTimeseries, aspectRetriever), From c600aa52b9a053f8ee885eba85e113edb469741f Mon Sep 17 00:00:00 2001 From: mac Date: Sat, 14 Sep 2024 20:39:34 +0530 Subject: [PATCH 02/14] Spotless fix --- .../main/java/com/linkedin/metadata/search/utils/ESUtils.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/metadata-io/src/main/java/com/linkedin/metadata/search/utils/ESUtils.java b/metadata-io/src/main/java/com/linkedin/metadata/search/utils/ESUtils.java index c44ce76c6440c..8420c5048f298 100644 --- a/metadata-io/src/main/java/com/linkedin/metadata/search/utils/ESUtils.java +++ b/metadata-io/src/main/java/com/linkedin/metadata/search/utils/ESUtils.java @@ -582,7 +582,8 @@ private static QueryBuilder buildWildcardQueryWithMultipleValues( QueryBuilders.wildcardQuery( toKeywordField(criterion.getField(), isTimeseries, aspectRetriever), String.format(wildcardPattern, ESUtils.escapeReservedCharacters(value.trim()))) - .queryName(queryName != null ? queryName : fieldName).caseInsensitive(true)); + .queryName(queryName != null ? queryName : fieldName) + .caseInsensitive(true)); } return boolQuery; } From 86caccc6a840153613fcebd4dc7e407d2726a7f8 Mon Sep 17 00:00:00 2001 From: Kanav Narula Date: Tue, 17 Sep 2024 21:13:55 +0530 Subject: [PATCH 03/14] test cases --- .../com/linkedin/metadata/search/utils/ESUtilsTest.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/metadata-io/src/test/java/com/linkedin/metadata/search/utils/ESUtilsTest.java b/metadata-io/src/test/java/com/linkedin/metadata/search/utils/ESUtilsTest.java index 94241ec5e89b0..d171ef3cc7b2e 100644 --- a/metadata-io/src/test/java/com/linkedin/metadata/search/utils/ESUtilsTest.java +++ b/metadata-io/src/test/java/com/linkedin/metadata/search/utils/ESUtilsTest.java @@ -177,6 +177,7 @@ public void testGetQueryBuilderFromCriterionContain() { + " \"wildcard\" : {\n" + " \"myTestField.keyword\" : {\n" + " \"wildcard\" : \"*value1*\",\n" + + " \"case_insensitive\" : true,\n" + " \"boost\" : 1.0,\n" + " \"_name\" : \"myTestField\"\n" + " }\n" @@ -207,6 +208,7 @@ public void testGetQueryBuilderFromCriterionContain() { + " \"wildcard\" : {\n" + " \"myTestField.keyword\" : {\n" + " \"wildcard\" : \"*value1*\",\n" + + " \"case_insensitive\" : true,\n" + " \"boost\" : 1.0,\n" + " \"_name\" : \"myTestField\"\n" + " }\n" @@ -216,6 +218,7 @@ public void testGetQueryBuilderFromCriterionContain() { + " \"wildcard\" : {\n" + " \"myTestField.keyword\" : {\n" + " \"wildcard\" : \"*value2*\",\n" + + " \"case_insensitive\" : true,\n" + " \"boost\" : 1.0,\n" + " \"_name\" : \"myTestField\"\n" + " }\n" @@ -251,6 +254,7 @@ public void testWildcardQueryBuilderFromCriterionWhenStartsWith() { + " \"wildcard\" : {\n" + " \"myTestField.keyword\" : {\n" + " \"wildcard\" : \"value1*\",\n" + + " \"case_insensitive\" : true,\n" + " \"boost\" : 1.0,\n" + " \"_name\" : \"myTestField\"\n" + " }\n" @@ -281,6 +285,7 @@ public void testWildcardQueryBuilderFromCriterionWhenStartsWith() { + " \"wildcard\" : {\n" + " \"myTestField.keyword\" : {\n" + " \"wildcard\" : \"value1*\",\n" + + " \"case_insensitive\" : true,\n" + " \"boost\" : 1.0,\n" + " \"_name\" : \"myTestField\"\n" + " }\n" @@ -290,6 +295,7 @@ public void testWildcardQueryBuilderFromCriterionWhenStartsWith() { + " \"wildcard\" : {\n" + " \"myTestField.keyword\" : {\n" + " \"wildcard\" : \"value2*\",\n" + + " \"case_insensitive\" : true,\n" + " \"boost\" : 1.0,\n" + " \"_name\" : \"myTestField\"\n" + " }\n" @@ -322,6 +328,7 @@ public void testWildcardQueryBuilderFromCriterionWhenEndsWith() { + " \"wildcard\" : {\n" + " \"myTestField.keyword\" : {\n" + " \"wildcard\" : \"*value1\",\n" + + " \"case_insensitive\" : true,\n" + " \"boost\" : 1.0,\n" + " \"_name\" : \"myTestField\"\n" + " }\n" @@ -351,6 +358,7 @@ public void testWildcardQueryBuilderFromCriterionWhenEndsWith() { + " \"wildcard\" : {\n" + " \"myTestField.keyword\" : {\n" + " \"wildcard\" : \"*value1\",\n" + + " \"case_insensitive\" : true,\n" + " \"boost\" : 1.0,\n" + " \"_name\" : \"myTestField\"\n" + " }\n" @@ -360,6 +368,7 @@ public void testWildcardQueryBuilderFromCriterionWhenEndsWith() { + " \"wildcard\" : {\n" + " \"myTestField.keyword\" : {\n" + " \"wildcard\" : \"*value2\",\n" + + " \"case_insensitive\" : true,\n" + " \"boost\" : 1.0,\n" + " \"_name\" : \"myTestField\"\n" + " }\n" From dfd0b70d1a9d7dc4327d904ae72c20bf7c9a41af Mon Sep 17 00:00:00 2001 From: kanavnarula <33712591+kanavnarula@users.noreply.github.com> Date: Fri, 20 Sep 2024 09:10:36 +0530 Subject: [PATCH 04/14] Show user name while removing user from the group --- datahub-web-react/src/app/entity/group/GroupMembers.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/datahub-web-react/src/app/entity/group/GroupMembers.tsx b/datahub-web-react/src/app/entity/group/GroupMembers.tsx index 147c3f8030d0e..41580b02bcc28 100644 --- a/datahub-web-react/src/app/entity/group/GroupMembers.tsx +++ b/datahub-web-react/src/app/entity/group/GroupMembers.tsx @@ -138,9 +138,10 @@ export default function GroupMembers({ urn, pageSize, isExternalGroup, onChangeM }; const onRemoveMember = (memberUrn: string) => { + const memberName = memberUrn.replace('urn:li:corpuser:', ''); Modal.confirm({ title: `Confirm Group Member Removal`, - content: `Are you sure you want to remove this user from the group?`, + content: `Are you sure you want to remove "` + memberName + `" user from the group?` , onOk() { removeGroupMember(memberUrn); }, From 042d24127f88e4062a1a0693fc099de5badee358 Mon Sep 17 00:00:00 2001 From: kanavnarula <33712591+kanavnarula@users.noreply.github.com> Date: Fri, 20 Sep 2024 09:35:40 +0530 Subject: [PATCH 05/14] Fix linting issue --- datahub-web-react/src/app/entity/group/GroupMembers.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datahub-web-react/src/app/entity/group/GroupMembers.tsx b/datahub-web-react/src/app/entity/group/GroupMembers.tsx index 41580b02bcc28..268b7511189fd 100644 --- a/datahub-web-react/src/app/entity/group/GroupMembers.tsx +++ b/datahub-web-react/src/app/entity/group/GroupMembers.tsx @@ -141,7 +141,7 @@ export default function GroupMembers({ urn, pageSize, isExternalGroup, onChangeM const memberName = memberUrn.replace('urn:li:corpuser:', ''); Modal.confirm({ title: `Confirm Group Member Removal`, - content: `Are you sure you want to remove "` + memberName + `" user from the group?` , + content: `Are you sure you want to remove "${memberName}" user from the group?` , onOk() { removeGroupMember(memberUrn); }, From b2107d8eab960a7ff288f05ece307adcbf0a3d78 Mon Sep 17 00:00:00 2001 From: mac Date: Fri, 20 Sep 2024 11:53:59 +0530 Subject: [PATCH 06/14] Fix prettier issue --- datahub-web-react/src/app/entity/group/GroupMembers.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datahub-web-react/src/app/entity/group/GroupMembers.tsx b/datahub-web-react/src/app/entity/group/GroupMembers.tsx index 268b7511189fd..2a95028de4aff 100644 --- a/datahub-web-react/src/app/entity/group/GroupMembers.tsx +++ b/datahub-web-react/src/app/entity/group/GroupMembers.tsx @@ -141,7 +141,7 @@ export default function GroupMembers({ urn, pageSize, isExternalGroup, onChangeM const memberName = memberUrn.replace('urn:li:corpuser:', ''); Modal.confirm({ title: `Confirm Group Member Removal`, - content: `Are you sure you want to remove "${memberName}" user from the group?` , + content: `Are you sure you want to remove "${memberName}" user from the group?`, onOk() { removeGroupMember(memberUrn); }, From 8edeb3b4ba400690a73db644bc0fee08eaa9967b Mon Sep 17 00:00:00 2001 From: mac Date: Fri, 20 Sep 2024 12:19:01 +0530 Subject: [PATCH 07/14] remove double quotes --- datahub-web-react/src/app/entity/group/GroupMembers.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datahub-web-react/src/app/entity/group/GroupMembers.tsx b/datahub-web-react/src/app/entity/group/GroupMembers.tsx index 2a95028de4aff..061c12ad2f0c8 100644 --- a/datahub-web-react/src/app/entity/group/GroupMembers.tsx +++ b/datahub-web-react/src/app/entity/group/GroupMembers.tsx @@ -141,7 +141,7 @@ export default function GroupMembers({ urn, pageSize, isExternalGroup, onChangeM const memberName = memberUrn.replace('urn:li:corpuser:', ''); Modal.confirm({ title: `Confirm Group Member Removal`, - content: `Are you sure you want to remove "${memberName}" user from the group?`, + content: `Are you sure you want to remove ${memberName} user from the group?`, onOk() { removeGroupMember(memberUrn); }, From 7bc95ce64a75fc6b741b8ce0a8a14a873f91046b Mon Sep 17 00:00:00 2001 From: kanavnarula <33712591+kanavnarula@users.noreply.github.com> Date: Sat, 21 Sep 2024 13:19:10 +0530 Subject: [PATCH 08/14] Display username instead of urn --- .../src/app/entity/group/GroupMembers.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/datahub-web-react/src/app/entity/group/GroupMembers.tsx b/datahub-web-react/src/app/entity/group/GroupMembers.tsx index 061c12ad2f0c8..bd1d057583401 100644 --- a/datahub-web-react/src/app/entity/group/GroupMembers.tsx +++ b/datahub-web-react/src/app/entity/group/GroupMembers.tsx @@ -137,13 +137,13 @@ export default function GroupMembers({ urn, pageSize, isExternalGroup, onChangeM }, 3000); }; - const onRemoveMember = (memberUrn: string) => { - const memberName = memberUrn.replace('urn:li:corpuser:', ''); + const onRemoveMember = (memberUrnEntity: CorpUser) => { + const memberName = memberUrnEntity?.properties?.displayName || undefined; Modal.confirm({ title: `Confirm Group Member Removal`, content: `Are you sure you want to remove ${memberName} user from the group?`, onOk() { - removeGroupMember(memberUrn); + removeGroupMember(memberUrnEntity?.urn); }, onCancel() {}, okText: 'Yes', @@ -156,7 +156,7 @@ export default function GroupMembers({ urn, pageSize, isExternalGroup, onChangeM const total = relationships?.total || 0; const groupMembers = relationships?.relationships?.map((rel) => rel.entity as CorpUser) || []; - const getItems = (urnID: string): MenuProps['items'] => { + const getItems = (userUrnEntity: CorpUser): MenuProps['items'] => { return [ { key: 'make', @@ -170,7 +170,7 @@ export default function GroupMembers({ urn, pageSize, isExternalGroup, onChangeM { key: 'remove', disabled: isExternalGroup, - onClick: () => onRemoveMember(urnID), + onClick: () => onRemoveMember(userUrnEntity), label: ( Remove from Group @@ -211,7 +211,7 @@ export default function GroupMembers({ urn, pageSize, isExternalGroup, onChangeM - + From 5ef48eee6c8bbf8a3731f6e228bcaa6d5e0d2f61 Mon Sep 17 00:00:00 2001 From: mac Date: Sat, 21 Sep 2024 13:41:25 +0530 Subject: [PATCH 09/14] display name in place of urn --- .../src/app/entity/group/GroupMembers.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/datahub-web-react/src/app/entity/group/GroupMembers.tsx b/datahub-web-react/src/app/entity/group/GroupMembers.tsx index bd1d057583401..cda761b14ae0f 100644 --- a/datahub-web-react/src/app/entity/group/GroupMembers.tsx +++ b/datahub-web-react/src/app/entity/group/GroupMembers.tsx @@ -137,13 +137,13 @@ export default function GroupMembers({ urn, pageSize, isExternalGroup, onChangeM }, 3000); }; - const onRemoveMember = (memberUrnEntity: CorpUser) => { - const memberName = memberUrnEntity?.properties?.displayName || undefined; + const onRemoveMember = (memberEntity: CorpUser) => { + const memberName = memberEntity?.properties?.displayName || undefined; Modal.confirm({ title: `Confirm Group Member Removal`, content: `Are you sure you want to remove ${memberName} user from the group?`, onOk() { - removeGroupMember(memberUrnEntity?.urn); + removeGroupMember(memberEntity?.urn); }, onCancel() {}, okText: 'Yes', @@ -156,7 +156,7 @@ export default function GroupMembers({ urn, pageSize, isExternalGroup, onChangeM const total = relationships?.total || 0; const groupMembers = relationships?.relationships?.map((rel) => rel.entity as CorpUser) || []; - const getItems = (userUrnEntity: CorpUser): MenuProps['items'] => { + const getItems = (userEntity: CorpUser): MenuProps['items'] => { return [ { key: 'make', @@ -170,7 +170,7 @@ export default function GroupMembers({ urn, pageSize, isExternalGroup, onChangeM { key: 'remove', disabled: isExternalGroup, - onClick: () => onRemoveMember(userUrnEntity), + onClick: () => onRemoveMember(userEntity), label: ( Remove from Group From 392b35e527a64794627a4e398a5ef375c5884b13 Mon Sep 17 00:00:00 2001 From: kanavnarula <33712591+kanavnarula@users.noreply.github.com> Date: Wed, 23 Oct 2024 11:43:22 +0530 Subject: [PATCH 10/14] Use displayName method to pull corp user name --- datahub-web-react/src/app/entity/group/GroupMembers.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datahub-web-react/src/app/entity/group/GroupMembers.tsx b/datahub-web-react/src/app/entity/group/GroupMembers.tsx index cda761b14ae0f..28e81b438d4cb 100644 --- a/datahub-web-react/src/app/entity/group/GroupMembers.tsx +++ b/datahub-web-react/src/app/entity/group/GroupMembers.tsx @@ -138,7 +138,7 @@ export default function GroupMembers({ urn, pageSize, isExternalGroup, onChangeM }; const onRemoveMember = (memberEntity: CorpUser) => { - const memberName = memberEntity?.properties?.displayName || undefined; + const memberName = entityRegistry.getDisplayName(EntityType.CorpUser, memberEntity); Modal.confirm({ title: `Confirm Group Member Removal`, content: `Are you sure you want to remove ${memberName} user from the group?`, From b9af57eae1017e79c6d4ee423a115d35fbe7a810 Mon Sep 17 00:00:00 2001 From: kanavnarula Date: Thu, 24 Oct 2024 20:57:01 +0530 Subject: [PATCH 11/14] Add parent container hierarchy label to the container --- .../Container/ContainerSelectModal.tsx | 14 +++++- .../src/app/search/SearchFilterLabel.tsx | 8 +++- .../src/app/search/filters/FilterOption.tsx | 3 +- .../src/app/search/filters/utils.tsx | 43 +++++++++++++++---- .../src/graphql/fragments.graphql | 1 + datahub-web-react/src/graphql/search.graphql | 3 ++ 6 files changed, 61 insertions(+), 11 deletions(-) diff --git a/datahub-web-react/src/app/entity/shared/containers/profile/sidebar/Container/ContainerSelectModal.tsx b/datahub-web-react/src/app/entity/shared/containers/profile/sidebar/Container/ContainerSelectModal.tsx index 681f89831b92c..818d75c37696d 100644 --- a/datahub-web-react/src/app/entity/shared/containers/profile/sidebar/Container/ContainerSelectModal.tsx +++ b/datahub-web-react/src/app/entity/shared/containers/profile/sidebar/Container/ContainerSelectModal.tsx @@ -5,6 +5,8 @@ import { useGetSearchResultsLazyQuery } from '../../../../../../../graphql/searc import { Container, Entity, EntityType } from '../../../../../../../types.generated'; import { useEnterKeyListener } from '../../../../../../shared/useEnterKeyListener'; import { useEntityRegistry } from '../../../../../../useEntityRegistry'; +import { getParentEntities } from '../../../../../../search/filters/utils'; +import ParentEntities from '../../../../../../search/filters/ParentEntities'; type Props = { onCloseModal: () => void; @@ -26,7 +28,7 @@ const StyleTag = styled(Tag)` align-items: center; `; -const PreviewImage = styled.img` +export const PreviewImage = styled.img` max-height: 18px; width: auto; object-fit: contain; @@ -34,6 +36,10 @@ const PreviewImage = styled.img` margin-right: 4px; `; +export const ParentWrapper = styled.div` + max-width: 400px; +`; + export const ContainerSelectModal = ({ onCloseModal, defaultValues, onOkOverride, titleOverride }: Props) => { const [containerSearch, { data: platforSearchData }] = useGetSearchResultsLazyQuery(); const entityRegistry = useEntityRegistry(); @@ -65,10 +71,16 @@ export const ContainerSelectModal = ({ onCloseModal, defaultValues, onOkOverride // Renders a search result in the select dropdown. const renderSearchResult = (entity: Container) => { const displayName = entityRegistry.getDisplayName(EntityType.Container, entity); + const parentEntities: Entity[] = getParentEntities(entity as Entity) || []; const truncatedDisplayName = displayName.length > 25 ? `${displayName.slice(0, 25)}...` : displayName; return ( + {parentEntities.length > 0 && ( + + + + )} {truncatedDisplayName} diff --git a/datahub-web-react/src/app/search/SearchFilterLabel.tsx b/datahub-web-react/src/app/search/SearchFilterLabel.tsx index 5a0e75cc2ae1c..4f74009a15b29 100644 --- a/datahub-web-react/src/app/search/SearchFilterLabel.tsx +++ b/datahub-web-react/src/app/search/SearchFilterLabel.tsx @@ -23,6 +23,9 @@ import CustomAvatar from '../shared/avatar/CustomAvatar'; import { IconStyleType } from '../entity/Entity'; import { formatNumber } from '../shared/formatNumber'; import useGetBrowseV2LabelOverride from './filters/useGetBrowseV2LabelOverride'; +import { getParentEntities } from './filters/utils'; +import { ParentWrapper } from '../entity/shared/containers/profile/sidebar/Container/ContainerSelectModal'; +import ParentEntities from './filters/ParentEntities'; type Props = { field: string; @@ -157,11 +160,14 @@ export const SearchFilterLabel = ({ field, value, entity, count, hideCount }: Pr if (entity?.type === EntityType.Container) { const container = entity as Container; const displayName = entityRegistry.getDisplayName(EntityType.Container, container); + const parentEntities: Entity[] = getParentEntities(container as Entity) || []; const truncatedDisplayName = displayName.length > 25 ? `${displayName.slice(0, 25)}...` : displayName; return ( {!!container.platform?.properties?.logoUrl && ( - + <> + + )} {truncatedDisplayName} diff --git a/datahub-web-react/src/app/search/filters/FilterOption.tsx b/datahub-web-react/src/app/search/filters/FilterOption.tsx index 3749f44cbf671..50b78c7f0685c 100644 --- a/datahub-web-react/src/app/search/filters/FilterOption.tsx +++ b/datahub-web-react/src/app/search/filters/FilterOption.tsx @@ -8,6 +8,7 @@ import { generateColor } from '../../entity/shared/components/styled/StyledTag'; import { ANTD_GRAY } from '../../entity/shared/constants'; import { useEntityRegistry } from '../../useEntityRegistry'; import { + CONTAINER_FILTER_NAME, ENTITY_SUB_TYPE_FILTER_NAME, MAX_COUNT_VAL, PLATFORM_FILTER_NAME, @@ -125,7 +126,7 @@ export default function FilterOption({ const { field, value, count, entity } = filterOption; const entityRegistry = useEntityRegistry(); const { icon, label } = getFilterIconAndLabel(field, value, entityRegistry, entity || null, 14); - const shouldShowIcon = field === PLATFORM_FILTER_NAME && icon !== null; + const shouldShowIcon = (field === PLATFORM_FILTER_NAME || field === CONTAINER_FILTER_NAME) && icon !== null; const shouldShowTagColor = field === TAGS_FILTER_NAME && entity?.type === EntityType.Tag; const isSubTypeFilter = field === TYPE_NAMES_FILTER_NAME; const parentEntities: Entity[] = getParentEntities(entity as Entity) || []; diff --git a/datahub-web-react/src/app/search/filters/utils.tsx b/datahub-web-react/src/app/search/filters/utils.tsx index f115277a04967..5535ca68e5862 100644 --- a/datahub-web-react/src/app/search/filters/utils.tsx +++ b/datahub-web-react/src/app/search/filters/utils.tsx @@ -20,6 +20,7 @@ import { FacetFilterInput, FacetMetadata, GlossaryTerm, + Container, } from '../../../types.generated'; import { IconStyleType } from '../../entity/Entity'; import { @@ -190,14 +191,37 @@ export function getFilterIconAndLabel( icon = ; label = getLastBrowseEntryFromFilterValue(filterValue); } else if (filterEntity) { - const { icon: newIcon, label: newLabel } = getFilterWithEntityIconAndLabel( - filterValue, - entityRegistry, - filterEntity, - size, - ); - icon = newIcon; - label = newLabel; + // Scenario where the filter entity exists and filterField is container + if (filterField === CONTAINER_FILTER_NAME) { + const logoUrl = (filterEntity as Container)?.platform?.properties?.logoUrl; + icon = logoUrl ? ( + + ) : ( + entityRegistry.getIcon(EntityType.DataPlatform, size || 12, IconStyleType.ACCENT, ANTD_GRAY[9]) + ); + label = entityRegistry.getDisplayName(filterEntity.type, filterEntity) + } else { + const { icon: newIcon, label: newLabel } = getFilterWithEntityIconAndLabel( + filterValue, + entityRegistry, + filterEntity, + size, + ); + + icon = newIcon; + label = newLabel; + } + + + + // const { icon: newIcon, label: newLabel } = getFilterWithEntityIconAndLabel( + // filterValue, + // entityRegistry, + // filterEntity, + // size, + // ); + // icon = newIcon; + // label = newLabel; } else { label = filterValue; } @@ -344,6 +368,9 @@ export function getParentEntities(entity: Entity): Entity[] | null { if (entity.type === EntityType.Domain) { return (entity as Domain).parentDomains?.domains || []; } + if (entity.type === EntityType.Container) { + return (entity as Container).parentContainers?.containers || []; + } return null; } diff --git a/datahub-web-react/src/graphql/fragments.graphql b/datahub-web-react/src/graphql/fragments.graphql index 7ce4082c42f61..501ff073d3477 100644 --- a/datahub-web-react/src/graphql/fragments.graphql +++ b/datahub-web-react/src/graphql/fragments.graphql @@ -1000,6 +1000,7 @@ fragment entityContainer on Container { fragment parentContainerFields on Container { urn + type properties { name } diff --git a/datahub-web-react/src/graphql/search.graphql b/datahub-web-react/src/graphql/search.graphql index 38c9df0a636d0..10e21560ff398 100644 --- a/datahub-web-react/src/graphql/search.graphql +++ b/datahub-web-react/src/graphql/search.graphql @@ -910,6 +910,9 @@ fragment facetFields on FacetMetadata { properties { name } + parentContainers { + ...parentContainersFields + } } ... on CorpUser { username From f2f12900db6a84c59ed30564baa2be36e55ed044 Mon Sep 17 00:00:00 2001 From: kanavnarula Date: Thu, 24 Oct 2024 20:58:45 +0530 Subject: [PATCH 12/14] Add parent container hierarchy label to the container --- datahub-web-react/src/app/search/filters/utils.tsx | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/datahub-web-react/src/app/search/filters/utils.tsx b/datahub-web-react/src/app/search/filters/utils.tsx index 5535ca68e5862..b2db28f4e4c99 100644 --- a/datahub-web-react/src/app/search/filters/utils.tsx +++ b/datahub-web-react/src/app/search/filters/utils.tsx @@ -211,17 +211,6 @@ export function getFilterIconAndLabel( icon = newIcon; label = newLabel; } - - - - // const { icon: newIcon, label: newLabel } = getFilterWithEntityIconAndLabel( - // filterValue, - // entityRegistry, - // filterEntity, - // size, - // ); - // icon = newIcon; - // label = newLabel; } else { label = filterValue; } From 77de8590ccaf4199932186587d6f16334c1c19d4 Mon Sep 17 00:00:00 2001 From: kanavnarula <33712591+kanavnarula@users.noreply.github.com> Date: Thu, 24 Oct 2024 21:00:36 +0530 Subject: [PATCH 13/14] Update GroupMembers.tsx --- .../src/app/entity/group/GroupMembers.tsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/datahub-web-react/src/app/entity/group/GroupMembers.tsx b/datahub-web-react/src/app/entity/group/GroupMembers.tsx index 28e81b438d4cb..147c3f8030d0e 100644 --- a/datahub-web-react/src/app/entity/group/GroupMembers.tsx +++ b/datahub-web-react/src/app/entity/group/GroupMembers.tsx @@ -137,13 +137,12 @@ export default function GroupMembers({ urn, pageSize, isExternalGroup, onChangeM }, 3000); }; - const onRemoveMember = (memberEntity: CorpUser) => { - const memberName = entityRegistry.getDisplayName(EntityType.CorpUser, memberEntity); + const onRemoveMember = (memberUrn: string) => { Modal.confirm({ title: `Confirm Group Member Removal`, - content: `Are you sure you want to remove ${memberName} user from the group?`, + content: `Are you sure you want to remove this user from the group?`, onOk() { - removeGroupMember(memberEntity?.urn); + removeGroupMember(memberUrn); }, onCancel() {}, okText: 'Yes', @@ -156,7 +155,7 @@ export default function GroupMembers({ urn, pageSize, isExternalGroup, onChangeM const total = relationships?.total || 0; const groupMembers = relationships?.relationships?.map((rel) => rel.entity as CorpUser) || []; - const getItems = (userEntity: CorpUser): MenuProps['items'] => { + const getItems = (urnID: string): MenuProps['items'] => { return [ { key: 'make', @@ -170,7 +169,7 @@ export default function GroupMembers({ urn, pageSize, isExternalGroup, onChangeM { key: 'remove', disabled: isExternalGroup, - onClick: () => onRemoveMember(userEntity), + onClick: () => onRemoveMember(urnID), label: ( Remove from Group @@ -211,7 +210,7 @@ export default function GroupMembers({ urn, pageSize, isExternalGroup, onChangeM - + From fbff6a93e866e3c162c58978de96ef45645e3912 Mon Sep 17 00:00:00 2001 From: kanavnarula Date: Thu, 24 Oct 2024 21:39:00 +0530 Subject: [PATCH 14/14] Linting fix: Add parent container hierarchy --- datahub-web-react/src/app/search/SearchFilterLabel.tsx | 9 ++++++--- datahub-web-react/src/app/search/filters/utils.tsx | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/datahub-web-react/src/app/search/SearchFilterLabel.tsx b/datahub-web-react/src/app/search/SearchFilterLabel.tsx index 4f74009a15b29..2ed2d4608de0d 100644 --- a/datahub-web-react/src/app/search/SearchFilterLabel.tsx +++ b/datahub-web-react/src/app/search/SearchFilterLabel.tsx @@ -165,9 +165,12 @@ export const SearchFilterLabel = ({ field, value, entity, count, hideCount }: Pr return ( {!!container.platform?.properties?.logoUrl && ( - <> - - + <> + + + + + )} {truncatedDisplayName} diff --git a/datahub-web-react/src/app/search/filters/utils.tsx b/datahub-web-react/src/app/search/filters/utils.tsx index b2db28f4e4c99..420ac3c13259e 100644 --- a/datahub-web-react/src/app/search/filters/utils.tsx +++ b/datahub-web-react/src/app/search/filters/utils.tsx @@ -199,7 +199,7 @@ export function getFilterIconAndLabel( ) : ( entityRegistry.getIcon(EntityType.DataPlatform, size || 12, IconStyleType.ACCENT, ANTD_GRAY[9]) ); - label = entityRegistry.getDisplayName(filterEntity.type, filterEntity) + label = entityRegistry.getDisplayName(filterEntity.type, filterEntity); } else { const { icon: newIcon, label: newLabel } = getFilterWithEntityIconAndLabel( filterValue,