mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 03:12:15 +00:00
fix(editor): Recover from unsaved finished execution (#5121)
* 🐛 Recover from unsaved fixed execution * 🔥 Remove logging * ✏️ Use i18n
This commit is contained in:
@@ -544,6 +544,11 @@ export interface IPushDataExecutionFinished {
|
|||||||
retryOf?: string;
|
retryOf?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface IPushDataUnsavedExecutionFinished {
|
||||||
|
executionId: string;
|
||||||
|
data: { finished: true; stoppedAt: Date };
|
||||||
|
}
|
||||||
|
|
||||||
export interface IPushDataExecutionStarted {
|
export interface IPushDataExecutionStarted {
|
||||||
executionId: string;
|
executionId: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -820,6 +820,8 @@
|
|||||||
"nodeView.showMessage.keyDown.title": "Workflow created",
|
"nodeView.showMessage.keyDown.title": "Workflow created",
|
||||||
"nodeView.showMessage.showMaxNodeTypeError.message": "Only one '{nodeTypeDataDisplayName}' node is allowed in a workflow | Only {count} '{nodeTypeDataDisplayName}' nodes are allowed in a workflow",
|
"nodeView.showMessage.showMaxNodeTypeError.message": "Only one '{nodeTypeDataDisplayName}' node is allowed in a workflow | Only {count} '{nodeTypeDataDisplayName}' nodes are allowed in a workflow",
|
||||||
"nodeView.showMessage.showMaxNodeTypeError.title": "Could not insert node",
|
"nodeView.showMessage.showMaxNodeTypeError.title": "Could not insert node",
|
||||||
|
"nodeView.showMessage.stopExecutionCatch.unsaved.message": "This execution was canceled",
|
||||||
|
"nodeView.showMessage.stopExecutionCatch.unsaved.title": "Execution canceled",
|
||||||
"nodeView.showMessage.stopExecutionCatch.message": "It completed before it could be stopped",
|
"nodeView.showMessage.stopExecutionCatch.message": "It completed before it could be stopped",
|
||||||
"nodeView.showMessage.stopExecutionCatch.title": "Workflow finished executing",
|
"nodeView.showMessage.stopExecutionCatch.title": "Workflow finished executing",
|
||||||
"nodeView.showMessage.stopExecutionTry.title": "Execution stopped",
|
"nodeView.showMessage.stopExecutionTry.title": "Execution stopped",
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import {
|
|||||||
INodeUpdatePropertiesInformation,
|
INodeUpdatePropertiesInformation,
|
||||||
IPushDataExecutionFinished,
|
IPushDataExecutionFinished,
|
||||||
IPushDataNodeExecuteAfter,
|
IPushDataNodeExecuteAfter,
|
||||||
|
IPushDataUnsavedExecutionFinished,
|
||||||
IUpdateInformation,
|
IUpdateInformation,
|
||||||
IUsedCredential,
|
IUsedCredential,
|
||||||
IWorkflowDb,
|
IWorkflowDb,
|
||||||
@@ -886,7 +887,9 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, {
|
|||||||
}
|
}
|
||||||
this.activeExecutions.unshift(newActiveExecution);
|
this.activeExecutions.unshift(newActiveExecution);
|
||||||
},
|
},
|
||||||
finishActiveExecution(finishedActiveExecution: IPushDataExecutionFinished): void {
|
finishActiveExecution(
|
||||||
|
finishedActiveExecution: IPushDataExecutionFinished | IPushDataUnsavedExecutionFinished,
|
||||||
|
): void {
|
||||||
// Find the execution to set to finished
|
// Find the execution to set to finished
|
||||||
const activeExecution = this.activeExecutions.find((execution) => {
|
const activeExecution = this.activeExecutions.find((execution) => {
|
||||||
return execution.id === finishedActiveExecution.executionId;
|
return execution.id === finishedActiveExecution.executionId;
|
||||||
|
|||||||
@@ -1383,7 +1383,28 @@ export default mixins(
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Execution stop might fail when the execution has already finished. Let's treat this here.
|
// Execution stop might fail when the execution has already finished. Let's treat this here.
|
||||||
const execution = await this.restApi().getExecution(executionId);
|
const execution = await this.restApi().getExecution(executionId);
|
||||||
if (execution?.finished) {
|
|
||||||
|
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 = null;
|
||||||
|
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 = {
|
const executedData = {
|
||||||
data: execution.data,
|
data: execution.data,
|
||||||
finished: execution.finished,
|
finished: execution.finished,
|
||||||
|
|||||||
Reference in New Issue
Block a user