mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 11:22:15 +00:00
✨ Add possibility to retry with currently saved workflow
This commit is contained in:
@@ -947,6 +947,18 @@ class App {
|
|||||||
retryOf: req.params.id,
|
retryOf: req.params.id,
|
||||||
workflowData: fullExecutionData.workflowData,
|
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 workflowRunner = new WorkflowRunner();
|
||||||
const executionId = await workflowRunner.run(data);
|
const executionId = await workflowRunner.run(data);
|
||||||
|
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ export interface IRestApi {
|
|||||||
getCredentialTypes(): Promise<ICredentialType[]>;
|
getCredentialTypes(): Promise<ICredentialType[]>;
|
||||||
getExecution(id: string): Promise<IExecutionResponse>;
|
getExecution(id: string): Promise<IExecutionResponse>;
|
||||||
deleteExecutions(sendData: IExecutionDeleteFilter): Promise<void>;
|
deleteExecutions(sendData: IExecutionDeleteFilter): Promise<void>;
|
||||||
retryExecution(id: string): Promise<boolean>;
|
retryExecution(id: string, loadWorkflow?: boolean): Promise<boolean>;
|
||||||
getTimezones(): Promise<IDataObject>;
|
getTimezones(): Promise<IDataObject>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,9 +91,17 @@
|
|||||||
</span>
|
</span>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
|
|
||||||
<el-button class="retry-button" circle v-if="scope.row.stoppedAt !== undefined && !scope.row.finished && scope.row.retryOf === undefined && scope.row.retrySuccessId === undefined" @click.stop="retryExecution(scope.row)" type="text" size="small" title="Retry execution">
|
<el-dropdown trigger="click" @command="handleRetryClick">
|
||||||
|
<span class="el-dropdown-link">
|
||||||
|
<el-button class="retry-button" circle v-if="scope.row.stoppedAt !== undefined && !scope.row.finished && scope.row.retryOf === undefined && scope.row.retrySuccessId === undefined" type="text" size="small" title="Retry execution">
|
||||||
<font-awesome-icon icon="redo" />
|
<font-awesome-icon icon="redo" />
|
||||||
</el-button>
|
</el-button>
|
||||||
|
</span>
|
||||||
|
<el-dropdown-menu slot="dropdown">
|
||||||
|
<el-dropdown-item :command="{command: 'currentlySaved', row: scope.row}">Retry with currently saved workflow</el-dropdown-item>
|
||||||
|
<el-dropdown-item :command="{command: 'original', row: scope.row}">Retry with original workflow</el-dropdown-item>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</el-dropdown>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@@ -343,6 +351,14 @@ export default mixins(
|
|||||||
handleFilterChanged () {
|
handleFilterChanged () {
|
||||||
this.refreshData();
|
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 {
|
getRowClass (data: IDataObject): string {
|
||||||
const classes: string[] = [];
|
const classes: string[] = [];
|
||||||
if ((data.row as IExecutionsSummary).stoppedAt === undefined) {
|
if ((data.row as IExecutionsSummary).stoppedAt === undefined) {
|
||||||
@@ -440,11 +456,11 @@ export default mixins(
|
|||||||
await this.loadWorkflows();
|
await this.loadWorkflows();
|
||||||
await this.refreshData();
|
await this.refreshData();
|
||||||
},
|
},
|
||||||
async retryExecution (execution: IExecutionShortResponse) {
|
async retryExecution (execution: IExecutionShortResponse, loadWorkflow?: boolean) {
|
||||||
this.isDataLoading = true;
|
this.isDataLoading = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const retrySuccessful = await this.restApi().retryExecution(execution.id);
|
const retrySuccessful = await this.restApi().retryExecution(execution.id, loadWorkflow);
|
||||||
|
|
||||||
if (retrySuccessful === true) {
|
if (retrySuccessful === true) {
|
||||||
this.$showMessage({
|
this.$showMessage({
|
||||||
|
|||||||
@@ -263,8 +263,14 @@ export const restApi = Vue.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Returns the execution with the given name
|
// Returns the execution with the given name
|
||||||
retryExecution: (id: string): Promise<boolean> => {
|
retryExecution: (id: string, loadWorkflow?: boolean): Promise<boolean> => {
|
||||||
return self.restApi().makeRestApiRequest('POST', `/executions/${id}/retry`);
|
let sendData;
|
||||||
|
if (loadWorkflow === true) {
|
||||||
|
sendData = {
|
||||||
|
loadWorkflow: true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return self.restApi().makeRestApiRequest('POST', `/executions/${id}/retry`, sendData);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Returns all saved executions
|
// Returns all saved executions
|
||||||
|
|||||||
Reference in New Issue
Block a user