diff --git a/js_modules/dagster-ui/packages/ui-core/src/launchpad/useLaunchMultipleRunsWithTelemetry.ts b/js_modules/dagster-ui/packages/ui-core/src/launchpad/useLaunchMultipleRunsWithTelemetry.ts index 9249da1025e91..f3ee3dd1f4e1d 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/launchpad/useLaunchMultipleRunsWithTelemetry.ts +++ b/js_modules/dagster-ui/packages/ui-core/src/launchpad/useLaunchMultipleRunsWithTelemetry.ts @@ -24,18 +24,29 @@ export function useLaunchMultipleRunsWithTelemetry() { const history = useHistory(); return useCallback( - async (variables: LaunchMultipleRunsMutationVariables, behavior: LaunchBehavior) => { + async ( + variables: LaunchMultipleRunsMutationVariables, + behavior: LaunchBehavior, + jobName: string, + ) => { try { const executionParamsList = Array.isArray(variables.executionParamsList) ? variables.executionParamsList : [variables.executionParamsList]; - const jobNames = executionParamsList.map( + + let jobNames = executionParamsList.map( (params) => params.selector.jobName || params.selector.pipelineName, ); if ( - jobNames.length !== executionParamsList.length || - jobNames.includes(undefined) || + (executionParamsList.length === 1 && jobNames.includes(undefined)) || + jobNames.includes(null) + ) { + jobNames = [jobName]; + } + + if ( + (jobNames.length !== executionParamsList.length && jobNames.includes(undefined)) || jobNames.includes(null) ) { throw new Error( diff --git a/js_modules/dagster-ui/packages/ui-core/src/ticks/EvaluateScheduleDialog.tsx b/js_modules/dagster-ui/packages/ui-core/src/ticks/EvaluateScheduleDialog.tsx index 7262979f9473a..4cb739a3d7447 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/ticks/EvaluateScheduleDialog.tsx +++ b/js_modules/dagster-ui/packages/ui-core/src/ticks/EvaluateScheduleDialog.tsx @@ -190,7 +190,7 @@ const EvaluateSchedule = ({repoAddress, name, onClose, jobName}: Props) => { try { if (executionParamsList) { - await launchMultipleRunsWithTelemetry({executionParamsList}, 'toast'); + await launchMultipleRunsWithTelemetry({executionParamsList}, 'toast', jobName); } } catch (e) { console.error(e); @@ -198,7 +198,14 @@ const EvaluateSchedule = ({repoAddress, name, onClose, jobName}: Props) => { setLaunching(false); onClose(); - }, [canLaunchAll, executionParamsList, launchMultipleRunsWithTelemetry, onClose, trackEvent]); + }, [ + canLaunchAll, + executionParamsList, + jobName, + launchMultipleRunsWithTelemetry, + onClose, + trackEvent, + ]); const content = useMemo(() => { // launching all runs state diff --git a/js_modules/dagster-ui/packages/ui-core/src/ticks/SensorDryRunDialog.tsx b/js_modules/dagster-ui/packages/ui-core/src/ticks/SensorDryRunDialog.tsx index 1047d13d9a391..83cad592e15a7 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/ticks/SensorDryRunDialog.tsx +++ b/js_modules/dagster-ui/packages/ui-core/src/ticks/SensorDryRunDialog.tsx @@ -196,7 +196,7 @@ const SensorDryRun = ({repoAddress, name, currentCursor, onClose, jobName}: Prop try { if (executionParamsList) { - await launchMultipleRunsWithTelemetry({executionParamsList}, 'toast'); + await launchMultipleRunsWithTelemetry({executionParamsList}, 'toast', jobName); onCommitTickResult(); // persist tick } } catch (e) { @@ -208,6 +208,7 @@ const SensorDryRun = ({repoAddress, name, currentCursor, onClose, jobName}: Prop }, [ canLaunchAll, executionParamsList, + jobName, launchMultipleRunsWithTelemetry, onClose, onCommitTickResult,