From 5d4264bbec05f72b53cb0a764e9b70c3e13af31f Mon Sep 17 00:00:00 2001 From: Marco polo Date: Fri, 28 Feb 2025 09:40:53 -0600 Subject: [PATCH] Add stub for create catalog view button + add create_view icon (#28091) As titled --- .../packages/ui-components/src/components/Icon.tsx | 2 ++ .../ui-components/src/icon-svgs/create_view.svg | 11 +++++++++++ .../ui-core/src/asset-graph/AssetGraphExplorer.tsx | 4 ++++ .../ui-core/src/assets/AssetsCatalogTable.tsx | 13 ++++--------- .../src/assets/CreateCatalogViewButton.oss.tsx | 1 + .../ui-core/src/selection/CustomErrorListener.ts | 7 ++++++- .../useSelectionInputLintingAndHighlighting.tsx | 4 ++++ 7 files changed, 32 insertions(+), 10 deletions(-) create mode 100644 js_modules/dagster-ui/packages/ui-components/src/icon-svgs/create_view.svg create mode 100644 js_modules/dagster-ui/packages/ui-core/src/assets/CreateCatalogViewButton.oss.tsx diff --git a/js_modules/dagster-ui/packages/ui-components/src/components/Icon.tsx b/js_modules/dagster-ui/packages/ui-components/src/components/Icon.tsx index aa5dc82cdad9d..adbeb5f1da3a9 100644 --- a/js_modules/dagster-ui/packages/ui-components/src/components/Icon.tsx +++ b/js_modules/dagster-ui/packages/ui-components/src/components/Icon.tsx @@ -95,6 +95,7 @@ import cost_rupee from '../icon-svgs/cost_rupee.svg'; import cost_yen from '../icon-svgs/cost_yen.svg'; import cpu from '../icon-svgs/cpu.svg'; import create from '../icon-svgs/create.svg'; +import create_view from '../icon-svgs/create_view.svg'; import credit_card from '../icon-svgs/credit_card.svg'; import credits from '../icon-svgs/credits.svg'; import curly_braces from '../icon-svgs/curly_braces.svg'; @@ -506,6 +507,7 @@ export const Icons = { cost_yen, cpu, create, + create_view, credit_card, credits, curly_braces, diff --git a/js_modules/dagster-ui/packages/ui-components/src/icon-svgs/create_view.svg b/js_modules/dagster-ui/packages/ui-components/src/icon-svgs/create_view.svg new file mode 100644 index 0000000000000..e0fc38e3966dd --- /dev/null +++ b/js_modules/dagster-ui/packages/ui-components/src/icon-svgs/create_view.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/js_modules/dagster-ui/packages/ui-core/src/asset-graph/AssetGraphExplorer.tsx b/js_modules/dagster-ui/packages/ui-core/src/asset-graph/AssetGraphExplorer.tsx index 6a04fbcc4938b..fc1493dafcc0f 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/asset-graph/AssetGraphExplorer.tsx +++ b/js_modules/dagster-ui/packages/ui-core/src/asset-graph/AssetGraphExplorer.tsx @@ -21,6 +21,7 @@ import {AssetGraphAssetSelectionInput} from 'shared/asset-graph/AssetGraphAssetS import {useAssetGraphExplorerFilters} from 'shared/asset-graph/useAssetGraphExplorerFilters.oss'; import {AssetSelectionInput} from 'shared/asset-selection/input/AssetSelectionInput.oss'; import {CatalogViewSelector} from 'shared/assets/CatalogViewSelector.oss'; +import {CreateCatalogViewButton} from 'shared/assets/CreateCatalogViewButton.oss'; import styled from 'styled-components'; import {AssetEdges} from './AssetEdges'; @@ -784,6 +785,9 @@ const AssetGraphExplorerWithData = ({ /> )} + {featureEnabled(FeatureFlag.flagSelectionSyntax) ? ( + + ) : null} + activeItems={new Set([view])} buttons={[ @@ -288,7 +282,8 @@ export const AssetsCatalogTable = ({ /> {featureEnabled(FeatureFlag.flagSelectionSyntax) ? : filterButton} {filterInput} - + {featureEnabled(FeatureFlag.flagSelectionSyntax) ? : null} + } belowActionBarComponents={ featureEnabled(FeatureFlag.flagSelectionSyntax) ? null : ( diff --git a/js_modules/dagster-ui/packages/ui-core/src/assets/CreateCatalogViewButton.oss.tsx b/js_modules/dagster-ui/packages/ui-core/src/assets/CreateCatalogViewButton.oss.tsx new file mode 100644 index 0000000000000..5cc7e10ce3806 --- /dev/null +++ b/js_modules/dagster-ui/packages/ui-core/src/assets/CreateCatalogViewButton.oss.tsx @@ -0,0 +1 @@ +export const CreateCatalogViewButton = () => null; diff --git a/js_modules/dagster-ui/packages/ui-core/src/selection/CustomErrorListener.ts b/js_modules/dagster-ui/packages/ui-core/src/selection/CustomErrorListener.ts index 1a3fdf0b125f0..97398bfe818ab 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/selection/CustomErrorListener.ts +++ b/js_modules/dagster-ui/packages/ui-core/src/selection/CustomErrorListener.ts @@ -22,10 +22,15 @@ export class CustomErrorListener implements ANTLRErrorListener { msg: string, _e: RecognitionException | undefined, ): void { + let from = charPositionInLine; + if (offendingSymbol?.text === '') { + // If the error is at the very end of the input, set the from to the start of the input + from = 0; + } this.errors.push({ message: msg, offendingSymbol: offendingSymbol?.text, - from: charPositionInLine, + from, to: charPositionInLine + (offendingSymbol?.text?.length ?? Infinity), }); } diff --git a/js_modules/dagster-ui/packages/ui-core/src/selection/useSelectionInputLintingAndHighlighting.tsx b/js_modules/dagster-ui/packages/ui-core/src/selection/useSelectionInputLintingAndHighlighting.tsx index fcee167ad6922..e7cb5082e3038 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/selection/useSelectionInputLintingAndHighlighting.tsx +++ b/js_modules/dagster-ui/packages/ui-core/src/selection/useSelectionInputLintingAndHighlighting.tsx @@ -84,6 +84,10 @@ export const useSelectionInputLintingAndHighlighting = ({ return null; } if (error.error.offendingSymbol) { + const symbol = error.error.offendingSymbol; + if (symbol === '') { + return 'Selection is incomplete'; + } return ( Unexpected input