Skip to content

Commit

Permalink
[ui] Further remove references to storage kind (#24130)
Browse files Browse the repository at this point in the history
## Summary

More cleanup - will be stacked with above PR and an internal companion
dagster-io/internal#11269
  • Loading branch information
benpankow authored Sep 2, 2024
1 parent 79915ef commit 9b9b968
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 91 deletions.
17 changes: 3 additions & 14 deletions js_modules/dagster-ui/packages/ui-core/src/graph/KindTags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@ import {CaptionMono, Tooltip} from '@dagster-io/ui-components';
import * as React from 'react';

import {OpTags} from './OpTags';
import {DefinitionTag, buildDefinitionTag} from '../graphql/types';
import {
linkToAssetTableWithComputeKindFilter,
linkToAssetTableWithStorageKindFilter,
} from '../search/useGlobalSearch';
import {DefinitionTag} from '../graphql/types';
import {linkToAssetTableWithComputeKindFilter} from '../search/useGlobalSearch';
import {StaticSetFilter} from '../ui/BaseFilters/useStaticSetFilter';

export const LEGACY_COMPUTE_KIND_TAG = 'kind';
Expand All @@ -17,8 +14,6 @@ export const STORAGE_KIND_TAG = 'dagster/storage_kind';
export const isCanonicalComputeKindTag = (tag: DefinitionTag) =>
tag.key === COMPUTE_KIND_TAG || tag.key === LEGACY_COMPUTE_KIND_TAG;
export const isCanonicalStorageKindTag = (tag: DefinitionTag) => tag.key === STORAGE_KIND_TAG;
export const buildStorageKindTag = (storageKind: string): DefinitionTag =>
buildDefinitionTag({key: 'dagster/storage_kind', value: storageKind});

export const AssetComputeKindTag = ({
definition,
Expand Down Expand Up @@ -120,13 +115,7 @@ export const AssetStorageKindTag = ({
tags={[
{
label: storageKind,
onClick: currentPageFilter
? () => currentPageFilter.setState(new Set([buildStorageKindTag(storageKind)]))
: shouldLink
? () => {
window.location.href = linkToAssetTableWithStorageKindFilter(storageKind);
}
: () => {},
onClick: () => {},
},
]}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {COMMON_COLLATOR} from '../app/Util';
import {AssetTableDefinitionFragment} from '../assets/types/AssetTableFragment.types';
import {isCanonicalStorageKindTag} from '../graph/KindTags';
import {DefinitionTag} from '../graphql/types';
import {buildTagString} from '../ui/tagAsString';
import {buildRepoPathForHuman} from '../workspace/buildRepoAddress';
Expand All @@ -18,11 +17,6 @@ type CountByComputeKind = {
assetCount: number;
};

type CountByStorageKind = {
storageKind: string;
assetCount: number;
};

type CountPerTag = {
tag: DefinitionTag;
assetCount: number;
Expand All @@ -44,7 +38,6 @@ type AssetCountsResult = {
countPerTag: CountPerTag[];
countPerAssetGroup: CountPerGroupName[];
countPerCodeLocation: CountPerCodeLocation[];
countsByStorageKind: CountByStorageKind[];
};

export type GroupMetadata = {
Expand Down Expand Up @@ -82,7 +75,6 @@ class CaseInsensitiveCounters {
export function buildAssetCountBySection(assets: AssetDefinitionMetadata[]): AssetCountsResult {
const assetCountByOwner = new CaseInsensitiveCounters();
const assetCountByComputeKind = new CaseInsensitiveCounters();
const assetCountByStorageKind = new CaseInsensitiveCounters();
const assetCountByGroup = new CaseInsensitiveCounters();
const assetCountByCodeLocation = new CaseInsensitiveCounters();
const assetCountByTag = new CaseInsensitiveCounters();
Expand All @@ -102,12 +94,8 @@ export function buildAssetCountBySection(assets: AssetDefinitionMetadata[]): Ass
}

assetDefinition.tags.forEach((tag) => {
if (isCanonicalStorageKindTag(tag)) {
assetCountByStorageKind.increment(tag.value);
} else {
const stringifiedTag = JSON.stringify(tag);
assetCountByTag.increment(stringifiedTag);
}
const stringifiedTag = JSON.stringify(tag);
assetCountByTag.increment(stringifiedTag);
});

const groupName = assetDefinition.groupName;
Expand Down Expand Up @@ -144,15 +132,6 @@ export function buildAssetCountBySection(assets: AssetDefinitionMetadata[]): Ass
.sort(({computeKind: computeKindA}, {computeKind: computeKindB}) =>
COMMON_COLLATOR.compare(computeKindA, computeKindB),
);
const countsByStorageKind = assetCountByStorageKind
.entries()
.map(([storageKind, count]) => ({
storageKind,
assetCount: count,
}))
.sort(({storageKind: storageKindA}, {storageKind: storageKindB}) =>
COMMON_COLLATOR.compare(storageKindA, storageKindB),
);

const countPerTag = assetCountByTag
.entries()
Expand Down Expand Up @@ -211,6 +190,5 @@ export function buildAssetCountBySection(assets: AssetDefinitionMetadata[]): Ass
countPerTag,
countPerAssetGroup,
countPerCodeLocation,
countsByStorageKind,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
isAssetFilterSearchResultType,
} from './types';
import {assertUnreachable} from '../app/Util';
import {isCanonicalComputeKindTag, isCanonicalStorageKindTag} from '../graph/KindTags';
import {isCanonicalComputeKindTag} from '../graph/KindTags';
import {KNOWN_TAGS, TagIcon} from '../graph/OpTags';

const iconForType = (type: SearchResultType | AssetFilterSearchResultType): IconName => {
Expand Down Expand Up @@ -53,8 +53,6 @@ const iconForType = (type: SearchResultType | AssetFilterSearchResultType): Icon
return 'compute_kind';
case AssetFilterSearchResultType.Tag:
return 'tag';
case AssetFilterSearchResultType.StorageKind:
return 'storage_kind';
case SearchResultType.Page:
return 'source';
case AssetFilterSearchResultType.Column:
Expand All @@ -76,8 +74,6 @@ const assetFilterPrefixString = (type: AssetFilterSearchResultType): string => {
return 'Owner';
case AssetFilterSearchResultType.AssetGroup:
return 'Group';
case AssetFilterSearchResultType.StorageKind:
return 'Storage kind';
case AssetFilterSearchResultType.Column:
return 'Column';
default:
Expand Down Expand Up @@ -141,13 +137,6 @@ function buildSearchIcons(item: SearchResult, isHighlight: boolean): JSX.Element

icons.push(computeKindSearchIcon);
}

const storageKindTag = item.tags?.find(isCanonicalStorageKindTag);
if (storageKindTag && KNOWN_TAGS[storageKindTag.value]) {
const storageKindSearchIcon = <TagIcon label={storageKindTag.value} />;

icons.push(storageKindSearchIcon);
}
}

if (item.type === AssetFilterSearchResultType.ComputeKind) {
Expand Down
2 changes: 0 additions & 2 deletions js_modules/dagster-ui/packages/ui-core/src/search/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export enum AssetFilterSearchResultType {
CodeLocation = 'AssetFilterSearchResultType.CodeLocation',
Owner = 'AssetFilterSearchResultType.Owner',
AssetGroup = 'AssetFilterSearchResultType.AssetGroup',
StorageKind = 'AssetFilterSearchResultType.StorageKind',
Column = 'AssetFilterSearchResultType.Column',
}

Expand All @@ -44,7 +43,6 @@ export function isAssetFilterSearchResultType(
type === AssetFilterSearchResultType.AssetGroup ||
type === AssetFilterSearchResultType.CodeLocation ||
type === AssetFilterSearchResultType.ComputeKind ||
type === AssetFilterSearchResultType.StorageKind ||
type === AssetFilterSearchResultType.Owner ||
type === AssetFilterSearchResultType.Tag ||
type === AssetFilterSearchResultType.Column
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {CloudOSSContext} from '../app/CloudOSSContext';
import {PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorFragment';
import {displayNameForAssetKey, isHiddenAssetGroupJob} from '../asset-graph/Utils';
import {assetDetailsPathForKey} from '../assets/assetDetailsPathForKey';
import {buildStorageKindTag, isCanonicalStorageKindTag} from '../graph/KindTags';
import {AssetOwner, DefinitionTag, buildDefinitionTag} from '../graphql/types';
import {buildTagString} from '../ui/tagAsString';
import {buildRepoPathForHuman} from '../workspace/buildRepoAddress';
Expand All @@ -35,12 +34,6 @@ export const linkToAssetTableWithComputeKindFilter = (computeKind: string) => {
})}`;
};

export const linkToAssetTableWithStorageKindFilter = (storageKind: string) => {
return `/assets?${qs.stringify({
storageKindTags: JSON.stringify([buildStorageKindTag(storageKind)]),
})}`;
};

export const linkToAssetTableWithTagFilter = (tag: Omit<DefinitionTag, '__typename'>) => {
return `/assets?${qs.stringify({
tags: JSON.stringify([tag]),
Expand Down Expand Up @@ -220,13 +213,11 @@ const secondaryDataToSearchResults = (
node,
href: assetDetailsPathForKey(node.key),
type: SearchResultType.Asset,
tags: node
.definition!.tags.filter(isCanonicalStorageKindTag)
.concat(
node.definition!.computeKind
? buildDefinitionTag({key: 'dagster/compute_kind', value: node.definition!.computeKind})
: [],
),
tags: node.definition!.tags.concat(
node.definition!.computeKind
? buildDefinitionTag({key: 'dagster/compute_kind', value: node.definition!.computeKind})
: [],
),
}));

if (searchContext === 'global') {
Expand All @@ -243,15 +234,6 @@ const secondaryDataToSearchResults = (
numResults: assetCount,
}),
);
const storageKindResults: SearchResult[] = countsBySection.countsByStorageKind.map(
({storageKind, assetCount}) => ({
label: storageKind,
description: '',
type: AssetFilterSearchResultType.StorageKind,
href: linkToAssetTableWithStorageKindFilter(storageKind),
numResults: assetCount,
}),
);

const tagResults: SearchResult[] = countsBySection.countPerTag.map(({tag, assetCount}) => ({
label: buildTagString(tag),
Expand Down Expand Up @@ -300,7 +282,6 @@ const secondaryDataToSearchResults = (
return [
...assets,
...computeKindResults,
...storageKindResults,
...tagResults,
...codeLocationResults,
...ownerResults,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ import {StaleReasonsLabel} from '../assets/Stale';
import {assetDetailsPathForKey} from '../assets/assetDetailsPathForKey';
import {AssetTableDefinitionFragment} from '../assets/types/AssetTableFragment.types';
import {AssetViewType} from '../assets/useAssetView';
import {
AssetComputeKindTag,
AssetStorageKindTag,
isCanonicalStorageKindTag,
} from '../graph/KindTags';
import {AssetComputeKindTag} from '../graph/KindTags';
import {AssetKeyInput} from '../graphql/types';
import {RepositoryLink} from '../nav/RepositoryLink';
import {TimestampDisplay} from '../schedules/TimestampDisplay';
Expand Down Expand Up @@ -87,8 +83,6 @@ export const VirtualizedAssetRow = (props: AssetRowProps) => {
}
};

const storageKindTag = definition?.tags.find(isCanonicalStorageKindTag);

return (
<Row $height={height} $start={start} data-testid={testId(`row-${tokenForAssetKey({path})}`)}>
<RowGrid border="bottom" $showRepoColumn={showRepoColumn}>
Expand Down Expand Up @@ -117,14 +111,6 @@ export const VirtualizedAssetRow = (props: AssetRowProps) => {
currentPageFilter={computeKindFilter}
/>
)}
{storageKindTag && (
<AssetStorageKindTag
reduceColor
reduceText
storageKind={storageKindTag.value}
style={{position: 'relative'}}
/>
)}
</Box>
<div
style={{
Expand Down

1 comment on commit 9b9b968

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for dagit-core-storybook ready!

✅ Preview
https://dagit-core-storybook-dffqhi48p-elementl.vercel.app

Built with commit 9b9b968.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.