Skip to content

Commit 2d642c0

Browse files
authored
Elevate - Container condition
1 parent fbff6a9 commit 2d642c0

File tree

1 file changed

+18
-20
lines changed
  • datahub-web-react/src/app/search/filters

1 file changed

+18
-20
lines changed

datahub-web-react/src/app/search/filters/utils.tsx

+18-20
Original file line numberDiff line numberDiff line change
@@ -187,30 +187,28 @@ export function getFilterIconAndLabel(
187187
entityRegistry.getIcon(EntityType.DataPlatform, size || 12, IconStyleType.ACCENT, ANTD_GRAY[9])
188188
);
189189
label = filterEntity ? entityRegistry.getDisplayName(EntityType.DataPlatform, filterEntity) : filterValue;
190+
} else if (filterField === CONTAINER_FILTER_NAME) {
191+
// Scenario where the filter entity exists and filterField is container
192+
const logoUrl = (filterEntity as Container)?.platform?.properties?.logoUrl;
193+
icon = logoUrl ? (
194+
<PlatformIcon src={logoUrl} size={size} />
195+
) : (
196+
entityRegistry.getIcon(EntityType.DataPlatform, size || 12, IconStyleType.ACCENT, ANTD_GRAY[9])
197+
);
198+
label = entityRegistry.getDisplayName(EntityType.Container, filterEntity)
190199
} else if (filterField === BROWSE_PATH_V2_FILTER_NAME) {
191200
icon = <FolderFilled size={size} color="black" />;
192201
label = getLastBrowseEntryFromFilterValue(filterValue);
193202
} else if (filterEntity) {
194-
// Scenario where the filter entity exists and filterField is container
195-
if (filterField === CONTAINER_FILTER_NAME) {
196-
const logoUrl = (filterEntity as Container)?.platform?.properties?.logoUrl;
197-
icon = logoUrl ? (
198-
<PlatformIcon src={logoUrl} size={size} />
199-
) : (
200-
entityRegistry.getIcon(EntityType.DataPlatform, size || 12, IconStyleType.ACCENT, ANTD_GRAY[9])
201-
);
202-
label = entityRegistry.getDisplayName(filterEntity.type, filterEntity);
203-
} else {
204-
const { icon: newIcon, label: newLabel } = getFilterWithEntityIconAndLabel(
205-
filterValue,
206-
entityRegistry,
207-
filterEntity,
208-
size,
209-
);
210-
211-
icon = newIcon;
212-
label = newLabel;
213-
}
203+
const { icon: newIcon, label: newLabel } = getFilterWithEntityIconAndLabel(
204+
filterValue,
205+
entityRegistry,
206+
filterEntity,
207+
size,
208+
);
209+
210+
icon = newIcon;
211+
label = newLabel;
214212
} else {
215213
label = filterValue;
216214
}

0 commit comments

Comments
 (0)