diff --git a/packages/cli/src/Server.ts b/packages/cli/src/Server.ts index f2c55bc68..cfbdea72f 100644 --- a/packages/cli/src/Server.ts +++ b/packages/cli/src/Server.ts @@ -947,6 +947,18 @@ class App { retryOf: req.params.id, workflowData: fullExecutionData.workflowData, }; + + if (req.body.loadWorkflow === true) { + // Loads the currently saved workflow to execute instead of the + // one saved at the time of the execution. + const workflowId = fullExecutionData.workflowData.id; + data.workflowData = await Db.collections.Workflow!.findOne(workflowId) as IWorkflowBase; + + if (data.workflowData === undefined) { + throw new Error(`The workflow with the ID "${workflowId}" could not be found and so the data not be loaded for the retry.`); + } + } + const workflowRunner = new WorkflowRunner(); const executionId = await workflowRunner.run(data); diff --git a/packages/editor-ui/src/Interface.ts b/packages/editor-ui/src/Interface.ts index 1f096d566..18d30db63 100644 --- a/packages/editor-ui/src/Interface.ts +++ b/packages/editor-ui/src/Interface.ts @@ -142,7 +142,7 @@ export interface IRestApi { getCredentialTypes(): Promise; getExecution(id: string): Promise; deleteExecutions(sendData: IExecutionDeleteFilter): Promise; - retryExecution(id: string): Promise; + retryExecution(id: string, loadWorkflow?: boolean): Promise; getTimezones(): Promise; } diff --git a/packages/editor-ui/src/components/ExecutionsList.vue b/packages/editor-ui/src/components/ExecutionsList.vue index da6888cfb..541e77d1b 100644 --- a/packages/editor-ui/src/components/ExecutionsList.vue +++ b/packages/editor-ui/src/components/ExecutionsList.vue @@ -91,9 +91,17 @@ - - - + + + + + + + + Retry with currently saved workflow + Retry with original workflow + + @@ -343,6 +351,14 @@ export default mixins( handleFilterChanged () { this.refreshData(); }, + handleRetryClick (commandData: { command: string, row: IExecutionShortResponse }) { + let loadWorkflow = false; + if (commandData.command === 'currentlySaved') { + loadWorkflow = true; + } + + this.retryExecution(commandData.row, loadWorkflow); + }, getRowClass (data: IDataObject): string { const classes: string[] = []; if ((data.row as IExecutionsSummary).stoppedAt === undefined) { @@ -440,11 +456,11 @@ export default mixins( await this.loadWorkflows(); await this.refreshData(); }, - async retryExecution (execution: IExecutionShortResponse) { + async retryExecution (execution: IExecutionShortResponse, loadWorkflow?: boolean) { this.isDataLoading = true; try { - const retrySuccessful = await this.restApi().retryExecution(execution.id); + const retrySuccessful = await this.restApi().retryExecution(execution.id, loadWorkflow); if (retrySuccessful === true) { this.$showMessage({ diff --git a/packages/editor-ui/src/components/mixins/restApi.ts b/packages/editor-ui/src/components/mixins/restApi.ts index 09c0d7445..aae1965a2 100644 --- a/packages/editor-ui/src/components/mixins/restApi.ts +++ b/packages/editor-ui/src/components/mixins/restApi.ts @@ -263,8 +263,14 @@ export const restApi = Vue.extend({ }, // Returns the execution with the given name - retryExecution: (id: string): Promise => { - return self.restApi().makeRestApiRequest('POST', `/executions/${id}/retry`); + retryExecution: (id: string, loadWorkflow?: boolean): Promise => { + let sendData; + if (loadWorkflow === true) { + sendData = { + loadWorkflow: true, + }; + } + return self.restApi().makeRestApiRequest('POST', `/executions/${id}/retry`, sendData); }, // Returns all saved executions