Skip to content

Commit

Permalink
add correct links for groups / compute kind views
Browse files Browse the repository at this point in the history
  • Loading branch information
clairelin135 committed Mar 11, 2024
1 parent 1efa604 commit ce41857
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type AssetCountsResult = {
countPerCodeLocation: CountPerCodeLocation[];
};

type GroupMetadata = {
export type GroupMetadata = {
groupName: string;
repositoryLocationName: string;
repositoryName: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {gql} from '@apollo/client';
import qs from 'qs';
import {useCallback, useEffect, useRef} from 'react';

import {QueryResponse, WorkerSearchResult, createSearchWorker} from './createSearchWorker';
Expand All @@ -12,11 +13,21 @@ import {
import {useIndexedDBCachedQuery} from './useIndexedDBCachedQuery';
import {PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorFragment';
import {displayNameForAssetKey, isHiddenAssetGroupJob} from '../asset-graph/Utils';
import {buildAssetCountBySection} from '../assets/AssetsOverview';
import {GroupMetadata, buildAssetCountBySection} from '../assets/AssetsOverview';
import {assetDetailsPathForKey} from '../assets/assetDetailsPathForKey';
import {buildRepoPathForHuman} from '../workspace/buildRepoAddress';
import {workspacePath} from '../workspace/workspacePath';

const linkToAssetTableWithGroupFilter = (groupMetadata: GroupMetadata) => {
return `/assets?${qs.stringify({groups: JSON.stringify([groupMetadata])})}`;
};

const linkToAssetTableWithComputeKindFilter = (computeKind: string) => {
return `/assets?${qs.stringify({
computeKindTags: JSON.stringify([computeKind]),
})}`;
};

const primaryDataToSearchResults = (input: {data?: SearchPrimaryQuery}) => {
const {data} = input;

Expand Down Expand Up @@ -178,8 +189,7 @@ const secondaryDataToSearchResults = (
label: computeKind,
description: '',
type: AssetFilterSearchResultType.ComputeKind,
// TODO display correct link once https://github.com/dagster-io/dagster/pull/20342 lands
href: '/assets',
href: linkToAssetTableWithComputeKindFilter(computeKind),
numResults: count,
}));

Expand All @@ -202,8 +212,7 @@ const secondaryDataToSearchResults = (
label: groupAssetCount.groupMetadata.groupName,
description: '',
type: AssetFilterSearchResultType.AssetGroup,
// TODO display correct link once https://github.com/dagster-io/dagster/pull/20342 lands
href: '/assets',
href: linkToAssetTableWithGroupFilter(groupAssetCount.groupMetadata),
numResults: groupAssetCount.assetCount,
}),
);
Expand Down

0 comments on commit ce41857

Please sign in to comment.