Skip to content

Commit

Permalink
Add shared component for AssetGraphAssetSelectionInput (#25896)
Browse files Browse the repository at this point in the history
## Summary & Motivation

Cloud is going to override the component to do catalog view integration.

Also updated the lint rule to fix the bad auto import of shared
components.

## How I Tested These Changes

yarn lint for the lint rule (after having bad import)
  • Loading branch information
salazarm authored Nov 13, 2024
1 parent 19f5b2a commit f2cea02
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,19 @@ module.exports = createRule({
});
}
}

if (importPath.startsWith('js_modules/dagster-ui/packages/ui-core/src')) {
context.report({
node,
messageId: 'invalidSharedImport',
fix: (fixer) => {
return fixer.replaceText(
node.source,
`'${importPath.replace('js_modules/dagster-ui/packages/ui-core/src', 'shared')}'`,
);
},
});
}
}

return {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {ComponentProps} from 'react';

import {GraphQueryInput} from '../ui/GraphQueryInput';

export const AssetGraphAssetSelectionInput = (
props: Omit<ComponentProps<typeof GraphQueryInput>, 'type'>,
) => {
return <GraphQueryInput {...props} type="asset_graph" />;
};
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import uniq from 'lodash/uniq';
import without from 'lodash/without';
import * as React from 'react';
import {useLayoutEffect, useMemo, useState} from 'react';
import {AssetGraphAssetSelectionInput} from 'shared/asset-graph/AssetGraphAssetSelectionInput.oss';
import {useAssetGraphExplorerFilters} from 'shared/asset-graph/useAssetGraphExplorerFilters.oss';
import styled from 'styled-components';

Expand Down Expand Up @@ -71,7 +72,6 @@ import {
} from '../pipelines/GraphNotices';
import {ExplorerPath} from '../pipelines/PipelinePathUtils';
import {StaticSetFilter} from '../ui/BaseFilters/useStaticSetFilter';
import {GraphQueryInput} from '../ui/GraphQueryInput';
import {Loading} from '../ui/Loading';

type AssetNode = AssetNodeForGraphQueryFragment;
Expand Down Expand Up @@ -721,14 +721,13 @@ const AssetGraphExplorerWithData = ({
)}
<div>{filterButton}</div>
<GraphQueryInputFlexWrap>
<GraphQueryInput
type="asset_graph"
<AssetGraphAssetSelectionInput
items={graphQueryItems}
value={explorerPath.opsQuery}
placeholder="Type an asset subset…"
onChange={(opsQuery) =>
onChangeExplorerPath({...explorerPath, opsQuery}, 'replace')
}
onChange={(opsQuery: string) => {
onChangeExplorerPath({...explorerPath, opsQuery}, 'replace');
}}
popoverPosition="bottom-left"
/>
</GraphQueryInputFlexWrap>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {AssetGraphFilterBar} from 'shared/asset-graph/AssetGraphFilterBar.oss';
import {useAssetCatalogFiltering} from 'shared/assets/useAssetCatalogFiltering.oss';

import {AssetGraphFilterBar} from './AssetGraphFilterBar';
import {AssetGraphViewType, GraphNode} from './Utils';

type Props = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,12 @@ export function useQueryPersistedState<T extends QueryPersistedDataType>(
// the `replace` so that we surface any unwanted loops during development.
if (process.env.NODE_ENV !== 'production' || !areQueriesEqual(currentQueryString, next)) {
currentQueryString = next;
history.replace(`${location.pathname}?${qs.stringify(next, {arrayFormat: 'brackets'})}`);
history.replace(
`${history.location.pathname}?${qs.stringify(next, {arrayFormat: 'brackets'})}`,
);
}
},
[history, encode, location.pathname, options],
[history, encode, options],
);

if (!isEqual(valueRef.current, qsDecoded)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {dynamicKeyWithoutIndex, isDynamicStep} from '../gantt/DynamicStepSupport
import {GraphExplorerSolidFragment} from '../pipelines/types/GraphExplorer.types';
import {workspacePipelinePath} from '../workspace/workspacePath';

interface GraphQueryInputProps {
export interface GraphQueryInputProps {
intent?: Intent;
items: GraphQueryItem[];
value: string;
Expand Down

1 comment on commit f2cea02

@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-ae5ln73jt-elementl.vercel.app

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

Please sign in to comment.