mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-10 06:34:05 -08:00
fix(editor): Recover from unsaved finished execution (#5121)
* 🐛 Recover from unsaved fixed execution * 🔥 Remove logging * ✏️ Use i18n
This commit is contained in:
parent
819c4adb3c
commit
af55ecd64b
|
@ -544,6 +544,11 @@ export interface IPushDataExecutionFinished {
|
|||
retryOf?: string;
|
||||
}
|
||||
|
||||
export interface IPushDataUnsavedExecutionFinished {
|
||||
executionId: string;
|
||||
data: { finished: true; stoppedAt: Date };
|
||||
}
|
||||
|
||||
export interface IPushDataExecutionStarted {
|
||||
executionId: string;
|
||||
}
|
||||
|
|
|
@ -820,6 +820,8 @@
|
|||
"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.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.title": "Workflow finished executing",
|
||||
"nodeView.showMessage.stopExecutionTry.title": "Execution stopped",
|
||||
|
|
|
@ -15,6 +15,7 @@ import {
|
|||
INodeUpdatePropertiesInformation,
|
||||
IPushDataExecutionFinished,
|
||||
IPushDataNodeExecuteAfter,
|
||||
IPushDataUnsavedExecutionFinished,
|
||||
IUpdateInformation,
|
||||
IUsedCredential,
|
||||
IWorkflowDb,
|
||||
|
@ -886,7 +887,9 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, {
|
|||
}
|
||||
this.activeExecutions.unshift(newActiveExecution);
|
||||
},
|
||||
finishActiveExecution(finishedActiveExecution: IPushDataExecutionFinished): void {
|
||||
finishActiveExecution(
|
||||
finishedActiveExecution: IPushDataExecutionFinished | IPushDataUnsavedExecutionFinished,
|
||||
): void {
|
||||
// Find the execution to set to finished
|
||||
const activeExecution = this.activeExecutions.find((execution) => {
|
||||
return execution.id === finishedActiveExecution.executionId;
|
||||
|
|
|
@ -1383,7 +1383,28 @@ export default mixins(
|
|||
} catch (error) {
|
||||
// Execution stop might fail when the execution has already finished. Let's treat this here.
|
||||
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 = {
|
||||
data: execution.data,
|
||||
finished: execution.finished,
|
||||
|
|
Loading…
Reference in a new issue