From 857f2972fd62fdb6a1edffff1da3155f5578d7e8 Mon Sep 17 00:00:00 2001 From: benpankow Date: Fri, 6 Sep 2024 11:18:34 -0700 Subject: [PATCH] [3/k][ui] Hide kind tags from search results, filter list --- .../ui-core/src/search/BuildAssetSearchResults.tsx | 5 +++++ .../packages/ui-core/src/ui/Filters/useAssetTagFilter.tsx | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/js_modules/dagster-ui/packages/ui-core/src/search/BuildAssetSearchResults.tsx b/js_modules/dagster-ui/packages/ui-core/src/search/BuildAssetSearchResults.tsx index 2941a8a4df96b..ffc5912320ff3 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/search/BuildAssetSearchResults.tsx +++ b/js_modules/dagster-ui/packages/ui-core/src/search/BuildAssetSearchResults.tsx @@ -1,5 +1,6 @@ import {COMMON_COLLATOR} from '../app/Util'; import {AssetTableDefinitionFragment} from '../assets/types/AssetTableFragment.types'; +import {isKindTag} from '../graph/KindTags'; import {DefinitionTag} from '../graphql/types'; import {buildTagString} from '../ui/tagAsString'; import {buildRepoPathForHuman} from '../workspace/buildRepoAddress'; @@ -96,6 +97,10 @@ export function buildAssetCountBySection(assets: AssetDefinitionMetadata[]): Ass } assetDefinition.tags.forEach((tag) => { + // Skip kind tags + if (isKindTag(tag)) { + return; + } const stringifiedTag = JSON.stringify(tag); assetCountByTag.increment(stringifiedTag); }); diff --git a/js_modules/dagster-ui/packages/ui-core/src/ui/Filters/useAssetTagFilter.tsx b/js_modules/dagster-ui/packages/ui-core/src/ui/Filters/useAssetTagFilter.tsx index 6af15fe4712a5..b257e6d100a55 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/ui/Filters/useAssetTagFilter.tsx +++ b/js_modules/dagster-ui/packages/ui-core/src/ui/Filters/useAssetTagFilter.tsx @@ -2,6 +2,7 @@ import isEqual from 'lodash/isEqual'; import memoize from 'lodash/memoize'; import {useMemo} from 'react'; +import {isKindTag} from '../../graph/KindTags'; import {DefinitionTag} from '../../graphql/types'; import {TruncatedTextWithFullTextOnHover} from '../../nav/getLeftNavItemsForOption'; import {StaticBaseConfig, useStaticSetFilter} from '../BaseFilters/useStaticSetFilter'; @@ -84,7 +85,12 @@ export function useAssetTagsForAssets( Array.from( new Set( assets - .flatMap((a) => a.definition?.tags?.map((tag) => JSON.stringify(tag)) ?? []) + .flatMap( + (a) => + a.definition?.tags + ?.filter((tag) => !isKindTag(tag)) + .map((tag) => JSON.stringify(tag)) ?? [], + ) .filter((o) => o), ), )