fix: Stop listening button not working in NDV (#9023)
This commit is contained in:
committed by
कारतोफ्फेलस्क्रिप्ट™
parent
e2bde6b751
commit
02219dde2f
@@ -279,7 +279,6 @@ import type {
|
||||
INodeTypeDescription,
|
||||
INodeTypeNameVersion,
|
||||
IPinData,
|
||||
IRun,
|
||||
ITaskData,
|
||||
ITelemetryTrackProperties,
|
||||
IWorkflowBase,
|
||||
@@ -303,7 +302,6 @@ import type {
|
||||
IUpdateInformation,
|
||||
IWorkflowDataUpdate,
|
||||
XYPosition,
|
||||
IPushDataExecutionFinished,
|
||||
ITag,
|
||||
INewWorkflowData,
|
||||
IWorkflowTemplate,
|
||||
@@ -492,7 +490,7 @@ export default defineComponent({
|
||||
const { callDebounced } = useDebounce();
|
||||
const canvasPanning = useCanvasPanning(nodeViewRootRef, { onMouseMoveEnd });
|
||||
const workflowHelpers = useWorkflowHelpers({ router });
|
||||
const { runWorkflow } = useRunWorkflow({ router });
|
||||
const { runWorkflow, stopCurrentExecution } = useRunWorkflow({ router });
|
||||
|
||||
return {
|
||||
locale,
|
||||
@@ -509,6 +507,7 @@ export default defineComponent({
|
||||
onMouseMoveEnd,
|
||||
workflowHelpers,
|
||||
runWorkflow,
|
||||
stopCurrentExecution,
|
||||
callDebounced,
|
||||
...useCanvasMouseSelect(),
|
||||
...useGlobalLinkActions(),
|
||||
@@ -1930,67 +1929,8 @@ export default defineComponent({
|
||||
});
|
||||
},
|
||||
async stopExecution() {
|
||||
const executionId = this.workflowsStore.activeExecutionId;
|
||||
if (executionId === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
this.stopExecutionInProgress = true;
|
||||
await this.workflowsStore.stopCurrentExecution(executionId);
|
||||
} catch (error) {
|
||||
// Execution stop might fail when the execution has already finished. Let's treat this here.
|
||||
const execution = await this.workflowsStore.getExecution(executionId);
|
||||
|
||||
if (execution === undefined) {
|
||||
// execution finished but was not saved (e.g. due to low connectivity)
|
||||
|
||||
this.workflowsStore.finishActiveExecution({
|
||||
executionId,
|
||||
data: { finished: true, stoppedAt: new Date() },
|
||||
});
|
||||
this.workflowsStore.executingNode.length = 0;
|
||||
this.uiStore.removeActiveAction('workflowRunning');
|
||||
|
||||
this.titleSet(this.workflowsStore.workflowName, 'IDLE');
|
||||
this.showMessage({
|
||||
title: this.$locale.baseText('nodeView.showMessage.stopExecutionCatch.unsaved.title'),
|
||||
message: this.$locale.baseText(
|
||||
'nodeView.showMessage.stopExecutionCatch.unsaved.message',
|
||||
),
|
||||
type: 'success',
|
||||
});
|
||||
} else if (execution?.finished) {
|
||||
// execution finished before it could be stopped
|
||||
|
||||
const executedData = {
|
||||
data: execution.data,
|
||||
finished: execution.finished,
|
||||
mode: execution.mode,
|
||||
startedAt: execution.startedAt,
|
||||
stoppedAt: execution.stoppedAt,
|
||||
} as IRun;
|
||||
const pushData = {
|
||||
data: executedData,
|
||||
executionId,
|
||||
retryOf: execution.retryOf,
|
||||
} as IPushDataExecutionFinished;
|
||||
this.workflowsStore.finishActiveExecution(pushData);
|
||||
this.titleSet(execution.workflowData.name, 'IDLE');
|
||||
this.workflowsStore.executingNode.length = 0;
|
||||
this.workflowsStore.setWorkflowExecutionData(executedData as IExecutionResponse);
|
||||
this.uiStore.removeActiveAction('workflowRunning');
|
||||
this.showMessage({
|
||||
title: this.$locale.baseText('nodeView.showMessage.stopExecutionCatch.title'),
|
||||
message: this.$locale.baseText('nodeView.showMessage.stopExecutionCatch.message'),
|
||||
type: 'success',
|
||||
});
|
||||
} else {
|
||||
this.showError(error, this.$locale.baseText('nodeView.showError.stopExecution.title'));
|
||||
}
|
||||
}
|
||||
await this.stopCurrentExecution();
|
||||
this.stopExecutionInProgress = false;
|
||||
|
||||
void this.workflowHelpers.getWorkflowDataToSave().then((workflowData) => {
|
||||
const trackProps = {
|
||||
workflow_id: this.workflowsStore.workflowId,
|
||||
|
||||
Reference in New Issue
Block a user