From d9289c46c75f25b79d5952cb0819860cd5265c7d Mon Sep 17 00:00:00 2001 From: benpankow Date: Thu, 22 Aug 2024 09:08:35 -0700 Subject: [PATCH] [ui] Remove storage kind filter in preparation for consolidation --- .../useAssetGraphExplorerFilters.oss.tsx | 19 ++----- .../ui-core/src/assets/AssetTable.tsx | 4 -- .../ui-core/src/assets/AssetsCatalogTable.tsx | 2 - .../assets/useAssetCatalogFiltering.oss.tsx | 35 ++---------- .../useAssetDefinitionFilterState.oss.tsx | 23 -------- .../src/ui/Filters/useStorageKindFilter.tsx | 56 ------------------- .../packages/ui-core/src/ui/Filters/util.ts | 21 +++---- .../src/workspace/VirtualizedAssetRow.tsx | 5 +- .../src/workspace/VirtualizedAssetTable.tsx | 4 -- 9 files changed, 21 insertions(+), 148 deletions(-) delete mode 100644 js_modules/dagster-ui/packages/ui-core/src/ui/Filters/useStorageKindFilter.tsx diff --git a/js_modules/dagster-ui/packages/ui-core/src/asset-graph/useAssetGraphExplorerFilters.oss.tsx b/js_modules/dagster-ui/packages/ui-core/src/asset-graph/useAssetGraphExplorerFilters.oss.tsx index ecaa4ffdfb921..dd138e5e63476 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/asset-graph/useAssetGraphExplorerFilters.oss.tsx +++ b/js_modules/dagster-ui/packages/ui-core/src/asset-graph/useAssetGraphExplorerFilters.oss.tsx @@ -18,22 +18,15 @@ export function useAssetGraphExplorerFilters({ loading, clearExplorerPath, }: Props) { - const { - filterButton, - computeKindFilter, - storageKindFilter, - groupsFilter, - activeFiltersJsx, - filterFn, - } = useAssetCatalogFiltering({ - assets: nodes, - includeRepos: isGlobalGraph, - loading, - }); + const {filterButton, computeKindFilter, groupsFilter, activeFiltersJsx, filterFn} = + useAssetCatalogFiltering({ + assets: nodes, + includeRepos: isGlobalGraph, + loading, + }); return { computeKindTagsFilter: computeKindFilter, - storageKindTagsFilter: storageKindFilter, groupsFilter, button: filterButton, filterFn, diff --git a/js_modules/dagster-ui/packages/ui-core/src/assets/AssetTable.tsx b/js_modules/dagster-ui/packages/ui-core/src/assets/AssetTable.tsx index 686734271d84e..dc1c7dd4c4c52 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/assets/AssetTable.tsx +++ b/js_modules/dagster-ui/packages/ui-core/src/assets/AssetTable.tsx @@ -22,7 +22,6 @@ import {AssetViewType} from './useAssetView'; import {CloudOSSContext} from '../app/CloudOSSContext'; import {useUnscopedPermissions} from '../app/Permissions'; import {QueryRefreshCountdown, RefreshState} from '../app/QueryRefresh'; -import {DefinitionTag} from '../graphql/types'; import {useSelectionReducer} from '../hooks/useSelectionReducer'; import {testId} from '../testing/testId'; import {StaticSetFilter} from '../ui/BaseFilters/useStaticSetFilter'; @@ -41,7 +40,6 @@ interface Props { searchPath: string; isFiltered: boolean; computeKindFilter?: StaticSetFilter; - storageKindFilter?: StaticSetFilter; } export const AssetTable = ({ @@ -55,7 +53,6 @@ export const AssetTable = ({ isFiltered, view, computeKindFilter, - storageKindFilter, }: Props) => { const groupedByDisplayKey = useMemo( () => groupBy(assets, (a) => JSON.stringify(displayPathForAsset(a))), @@ -141,7 +138,6 @@ export const AssetTable = ({ showRepoColumn view={view} computeKindFilter={computeKindFilter} - storageKindFilter={storageKindFilter} /> ); }; diff --git a/js_modules/dagster-ui/packages/ui-core/src/assets/AssetsCatalogTable.tsx b/js_modules/dagster-ui/packages/ui-core/src/assets/AssetsCatalogTable.tsx index 13a6cc87d84c9..a9df19c7575a2 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/assets/AssetsCatalogTable.tsx +++ b/js_modules/dagster-ui/packages/ui-core/src/assets/AssetsCatalogTable.tsx @@ -208,7 +208,6 @@ export const AssetsCatalogTable = ({ filterButton, activeFiltersJsx, computeKindFilter, - storageKindFilter, } = useAssetCatalogFiltering({assets}); const {searchPath, filterInput, filtered} = useBasicAssetSearchInput( @@ -286,7 +285,6 @@ export const AssetsCatalogTable = ({ searchPath={searchPath} displayPathForAsset={displayPathForAsset} computeKindFilter={computeKindFilter} - storageKindFilter={storageKindFilter} /> ); }; diff --git a/js_modules/dagster-ui/packages/ui-core/src/assets/useAssetCatalogFiltering.oss.tsx b/js_modules/dagster-ui/packages/ui-core/src/assets/useAssetCatalogFiltering.oss.tsx index 392c3a1770ac4..ef50a9936a71c 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/assets/useAssetCatalogFiltering.oss.tsx +++ b/js_modules/dagster-ui/packages/ui-core/src/assets/useAssetCatalogFiltering.oss.tsx @@ -7,7 +7,6 @@ import { import {useAssetGroupSelectorsForAssets} from './AssetGroupSuggest'; import {CloudOSSContext} from '../app/CloudOSSContext'; -import {isCanonicalStorageKindTag} from '../graph/KindTags'; import {ChangeReason} from '../graphql/types'; import {useFilters} from '../ui/BaseFilters'; import {FilterObject} from '../ui/BaseFilters/useFilter'; @@ -20,7 +19,6 @@ import { useAssetKindTagsForAssets, useComputeKindTagFilter, } from '../ui/Filters/useComputeKindTagFilter'; -import {useStorageKindFilter} from '../ui/Filters/useStorageKindFilter'; import {WorkspaceContext} from '../workspace/WorkspaceContext'; import {buildRepoAddress} from '../workspace/buildRepoAddress'; @@ -53,7 +51,6 @@ export function useAssetCatalogFiltering< setGroups, setOwners, setCodeLocations, - setStorageKindTags, setSelectAllFilters, } = useAssetDefinitionFilterState({isEnabled}); @@ -88,24 +85,12 @@ export function useAssetCatalogFiltering< }); const tags = useAssetTagsForAssets(assets); - const storageKindTags = useMemo(() => tags.filter(isCanonicalStorageKindTag), [tags]); - const nonStorageKindTags = useMemo( - () => tags.filter((tag) => !isCanonicalStorageKindTag(tag)), - [tags], - ); const tagsFilter = useAssetTagFilter({ - allAssetTags: nonStorageKindTags, - tags: filters.selectAllFilters.includes('tags') ? nonStorageKindTags : filters.tags, + allAssetTags: tags, + tags: filters.selectAllFilters.includes('tags') ? tags : filters.tags, setTags: setAssetTags, }); - const storageKindFilter = useStorageKindFilter({ - allAssetStorageKindTags: storageKindTags, - storageKindTags: filters.selectAllFilters.includes('storageKindTags') - ? storageKindTags - : filters.storageKindTags, - setStorageKindTags, - }); const {isBranchDeployment} = React.useContext(CloudOSSContext); const {allRepos} = React.useContext(WorkspaceContext); @@ -124,13 +109,7 @@ export function useAssetCatalogFiltering< }); const uiFilters = React.useMemo(() => { - const uiFilters: FilterObject[] = [ - groupsFilter, - computeKindFilter, - storageKindFilter, - ownersFilter, - tagsFilter, - ]; + const uiFilters: FilterObject[] = [groupsFilter, computeKindFilter, ownersFilter, tagsFilter]; if (isBranchDeployment) { uiFilters.push(changedInBranchFilter); } @@ -147,7 +126,6 @@ export function useAssetCatalogFiltering< isBranchDeployment, ownersFilter, reposFilter, - storageKindFilter, tagsFilter, ]); const components = useFilters({filters: uiFilters}); @@ -176,9 +154,8 @@ export function useAssetCatalogFiltering< [ ['owners', filters.owners, allAssetOwners] as const, - ['tags', filters.tags, nonStorageKindTags] as const, + ['tags', filters.tags, tags] as const, ['computeKindTags', filters.computeKindTags, allComputeKindTags] as const, - ['storageKindTags', filters.storageKindTags, storageKindTags] as const, ['groups', filters.groups, allAssetGroupOptions] as const, ['changedInBranch', filters.changedInBranch, Object.values(ChangeReason)] as const, ['codeLocations', filters.codeLocations, allRepos] as const, @@ -210,9 +187,8 @@ export function useAssetCatalogFiltering< didWaitAfterLoading, filters, loading, - nonStorageKindTags, + tags, setSelectAllFilters, - storageKindTags, isEnabled, ]); @@ -228,7 +204,6 @@ export function useAssetCatalogFiltering< filterFn, filtered, computeKindFilter, - storageKindFilter, groupsFilter, renderFilterButton: components.renderButton, }; diff --git a/js_modules/dagster-ui/packages/ui-core/src/assets/useAssetDefinitionFilterState.oss.tsx b/js_modules/dagster-ui/packages/ui-core/src/assets/useAssetDefinitionFilterState.oss.tsx index ea7304fd20189..2e6de5c517064 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/assets/useAssetDefinitionFilterState.oss.tsx +++ b/js_modules/dagster-ui/packages/ui-core/src/assets/useAssetDefinitionFilterState.oss.tsx @@ -2,7 +2,6 @@ import isEqual from 'lodash/isEqual'; import {SetStateAction, useCallback, useMemo} from 'react'; import {buildAssetGroupSelector} from './AssetGroupSuggest'; -import {isCanonicalStorageKindTag} from '../graph/KindTags'; import { AssetGroupSelector, AssetNode, @@ -32,7 +31,6 @@ export type FilterableAssetDefinition = Nullable< export type AssetFilterBaseType = { groups: AssetGroupSelector[]; computeKindTags: string[]; - storageKindTags: DefinitionTag[]; changedInBranch: ChangeReason[]; owners: AssetOwner[]; tags: DefinitionTag[]; @@ -49,7 +47,6 @@ export const useAssetDefinitionFilterState = ({isEnabled = true}: {isEnabled?: b ? ({ groups, computeKindTags, - storageKindTags, changedInBranch, owners, tags, @@ -58,7 +55,6 @@ export const useAssetDefinitionFilterState = ({isEnabled = true}: {isEnabled?: b }) => ({ groups: groups?.length ? JSON.stringify(groups) : undefined, computeKindTags: computeKindTags?.length ? JSON.stringify(computeKindTags) : undefined, - storageKindTags: storageKindTags?.length ? JSON.stringify(storageKindTags) : undefined, changedInBranch: changedInBranch?.length ? JSON.stringify(changedInBranch) : undefined, owners: owners?.length ? JSON.stringify(owners) : undefined, tags: tags?.length ? JSON.stringify(tags) : undefined, @@ -69,7 +65,6 @@ export const useAssetDefinitionFilterState = ({isEnabled = true}: {isEnabled?: b decode: (qs) => ({ groups: qs.groups && isEnabled ? JSON.parse(qs.groups) : [], computeKindTags: qs.computeKindTags && isEnabled ? JSON.parse(qs.computeKindTags) : [], - storageKindTags: qs.storageKindTags && isEnabled ? JSON.parse(qs.storageKindTags) : [], changedInBranch: qs.changedInBranch && isEnabled ? JSON.parse(qs.changedInBranch) : [], owners: qs.owners && isEnabled ? JSON.parse(qs.owners) : [], tags: qs.tags && isEnabled ? JSON.parse(qs.tags) : [], @@ -90,7 +85,6 @@ export const useAssetDefinitionFilterState = ({isEnabled = true}: {isEnabled?: b const { setComputeKindTags, - setStorageKindTags, setGroups, setChangedInBranch, setOwners, @@ -108,7 +102,6 @@ export const useAssetDefinitionFilterState = ({isEnabled = true}: {isEnabled?: b } return { setComputeKindTags: makeSetter('computeKindTags'), - setStorageKindTags: makeSetter('storageKindTags'), setGroups: makeSetter('groups'), setChangedInBranch: makeSetter('changedInBranch'), setOwners: makeSetter('owners'), @@ -123,7 +116,6 @@ export const useAssetDefinitionFilterState = ({isEnabled = true}: {isEnabled?: b setFilters, filterFn, setComputeKindTags, - setStorageKindTags, setGroups, setChangedInBranch, setOwners, @@ -196,21 +188,6 @@ export function filterAssetDefinition( } } - const isAllStorageKindTagsSelected = filters.selectAllFilters?.includes('storageKindTags'); - const storageKindTag = definition?.tags?.find(isCanonicalStorageKindTag); - if (isAllStorageKindTagsSelected) { - if (!storageKindTag) { - return false; - } - } else if (filters.storageKindTags?.length) { - if ( - !storageKindTag || - !doesFilterArrayMatchValueArray(filters.storageKindTags, [storageKindTag]) - ) { - return false; - } - } - const isAllChangedInBranchSelected = filters.selectAllFilters?.includes('changedInBranch'); if (isAllChangedInBranchSelected) { if (!definition?.changedReasons?.length) { diff --git a/js_modules/dagster-ui/packages/ui-core/src/ui/Filters/useStorageKindFilter.tsx b/js_modules/dagster-ui/packages/ui-core/src/ui/Filters/useStorageKindFilter.tsx deleted file mode 100644 index 101f6322aee5f..0000000000000 --- a/js_modules/dagster-ui/packages/ui-core/src/ui/Filters/useStorageKindFilter.tsx +++ /dev/null @@ -1,56 +0,0 @@ -import {Box, Icon} from '@dagster-io/ui-components'; -import {useMemo} from 'react'; - -import {buildDefinitionTag} from './useAssetTagFilter'; -import {DefinitionTag} from '../../graphql/types'; -import {TruncatedTextWithFullTextOnHover} from '../../nav/getLeftNavItemsForOption'; -import {StaticBaseConfig, useStaticSetFilter} from '../BaseFilters/useStaticSetFilter'; - -const emptyArray: any[] = []; - -export const useStorageKindFilter = ({ - allAssetStorageKindTags, - storageKindTags, - setStorageKindTags, -}: { - allAssetStorageKindTags: DefinitionTag[]; - storageKindTags?: null | DefinitionTag[]; - setStorageKindTags?: null | ((s: DefinitionTag[]) => void); -}) => { - const memoizedState = useMemo(() => storageKindTags?.map(buildDefinitionTag), [storageKindTags]); - return useStaticSetFilter({ - allValues: useMemo( - () => - allAssetStorageKindTags.map((value) => ({ - value, - match: [value.key + ':' + value.value], - })), - [allAssetStorageKindTags], - ), - menuWidth: '300px', - state: memoizedState ?? emptyArray, - onStateChanged: (values) => { - setStorageKindTags?.(Array.from(values)); - }, - canSelectAll: false, - ...BaseConfig, - }); -}; - -export const getStringValue = ({value}: DefinitionTag) => value; - -export const BaseConfig: StaticBaseConfig = { - name: 'Storage kind', - icon: 'storage_kind', - renderLabel: ({value: tag}: {value: DefinitionTag}) => { - return ( - - - - - ); - }, - getStringValue, - getKey: getStringValue, - matchType: 'all-of', -}; diff --git a/js_modules/dagster-ui/packages/ui-core/src/ui/Filters/util.ts b/js_modules/dagster-ui/packages/ui-core/src/ui/Filters/util.ts index 6934117cd48d3..c7cf17baeb9a0 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/ui/Filters/util.ts +++ b/js_modules/dagster-ui/packages/ui-core/src/ui/Filters/util.ts @@ -1,18 +1,16 @@ -import {BaseConfig as AssetGroupsFilterBaseConfig} from './useAssetGroupFilter'; -import {BaseConfig as AssetOwnerFilterBaseConfig} from './useAssetOwnerFilter'; -import {BaseConfig as AssetTagFilterBaseConfig} from './useAssetTagFilter'; -import {BaseConfig as ChangedFilterBaseConfig} from './useChangedFilter'; -import {BaseConfig as CodeLocationFilterBaseConfig} from './useCodeLocationFilter'; -import {BaseConfig as ComputeKindTagFilterBaseConfig} from './useComputeKindTagFilter'; -import {BaseConfig as StorageKindFilterBaseConfig} from './useStorageKindFilter'; -import {AssetGroupSelector, AssetOwner, ChangeReason, DefinitionTag} from '../../graphql/types'; -import {RepoAddress} from '../../workspace/types'; -import {StaticBaseConfig} from '../BaseFilters/useStaticSetFilter'; +import { BaseConfig as AssetGroupsFilterBaseConfig } from './useAssetGroupFilter'; +import { BaseConfig as AssetOwnerFilterBaseConfig } from './useAssetOwnerFilter'; +import { BaseConfig as AssetTagFilterBaseConfig } from './useAssetTagFilter'; +import { BaseConfig as ChangedFilterBaseConfig } from './useChangedFilter'; +import { BaseConfig as CodeLocationFilterBaseConfig } from './useCodeLocationFilter'; +import { BaseConfig as ComputeKindTagFilterBaseConfig } from './useComputeKindTagFilter'; +import { AssetGroupSelector, AssetOwner, ChangeReason, DefinitionTag } from '../../graphql/types'; +import { RepoAddress } from '../../workspace/types'; +import { StaticBaseConfig } from '../BaseFilters/useStaticSetFilter'; export const STATIC_FILTER_CONFIGS: { groups: StaticBaseConfig; computeKindTags: StaticBaseConfig; - storageKindTags: StaticBaseConfig; changedInBranch: StaticBaseConfig; owners: StaticBaseConfig; tags: StaticBaseConfig; @@ -20,7 +18,6 @@ export const STATIC_FILTER_CONFIGS: { } = { groups: AssetGroupsFilterBaseConfig, computeKindTags: ComputeKindTagFilterBaseConfig, - storageKindTags: StorageKindFilterBaseConfig, changedInBranch: ChangedFilterBaseConfig, owners: AssetOwnerFilterBaseConfig, tags: AssetTagFilterBaseConfig, diff --git a/js_modules/dagster-ui/packages/ui-core/src/workspace/VirtualizedAssetRow.tsx b/js_modules/dagster-ui/packages/ui-core/src/workspace/VirtualizedAssetRow.tsx index 168042d12f4c3..ac2fb0cab7b89 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/workspace/VirtualizedAssetRow.tsx +++ b/js_modules/dagster-ui/packages/ui-core/src/workspace/VirtualizedAssetRow.tsx @@ -26,7 +26,7 @@ import { AssetStorageKindTag, isCanonicalStorageKindTag, } from '../graph/KindTags'; -import {AssetKeyInput, DefinitionTag} from '../graphql/types'; +import {AssetKeyInput} from '../graphql/types'; import {RepositoryLink} from '../nav/RepositoryLink'; import {useBlockTraceOnQueryResult} from '../performance/TraceContext'; import {TimestampDisplay} from '../schedules/TimestampDisplay'; @@ -52,7 +52,6 @@ interface AssetRowProps { start: number; onRefresh: () => void; computeKindFilter?: StaticSetFilter; - storageKindFilter?: StaticSetFilter; } export const VirtualizedAssetRow = (props: AssetRowProps) => { @@ -70,7 +69,6 @@ export const VirtualizedAssetRow = (props: AssetRowProps) => { showRepoColumn, view = 'flat', computeKindFilter, - storageKindFilter, } = props; const liveData = useLiveDataOrLatestMaterializationDebounced(path, type); @@ -126,7 +124,6 @@ export const VirtualizedAssetRow = (props: AssetRowProps) => { reduceText storageKind={storageKindTag.value} style={{position: 'relative'}} - currentPageFilter={storageKindFilter} /> )} diff --git a/js_modules/dagster-ui/packages/ui-core/src/workspace/VirtualizedAssetTable.tsx b/js_modules/dagster-ui/packages/ui-core/src/workspace/VirtualizedAssetTable.tsx index 536198d988daa..25e96e10cef9c 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/workspace/VirtualizedAssetTable.tsx +++ b/js_modules/dagster-ui/packages/ui-core/src/workspace/VirtualizedAssetTable.tsx @@ -5,7 +5,6 @@ import {VirtualizedAssetCatalogHeader, VirtualizedAssetRow} from './VirtualizedA import {buildRepoAddress} from './buildRepoAddress'; import {AssetTableFragment} from '../assets/types/AssetTableFragment.types'; import {AssetViewType} from '../assets/useAssetView'; -import {DefinitionTag} from '../graphql/types'; import {StaticSetFilter} from '../ui/BaseFilters/useStaticSetFilter'; import {Container, Inner} from '../ui/VirtualizedTable'; @@ -23,7 +22,6 @@ interface Props { showRepoColumn: boolean; view?: AssetViewType; computeKindFilter?: StaticSetFilter; - storageKindFilter?: StaticSetFilter; } export const VirtualizedAssetTable = (props: Props) => { @@ -37,7 +35,6 @@ export const VirtualizedAssetTable = (props: Props) => { showRepoColumn, view = 'flat', computeKindFilter, - storageKindFilter, } = props; const parentRef = React.useRef(null); const count = Object.keys(groups).length; @@ -100,7 +97,6 @@ export const VirtualizedAssetTable = (props: Props) => { onToggleChecked={onToggleFactory(row.displayKey)} onRefresh={onRefresh} computeKindFilter={computeKindFilter} - storageKindFilter={storageKindFilter} /> ); })}