Add possibility to retry with currently saved workflow

This commit is contained in:
Jan Oberhauser
2019-12-12 18:12:38 -06:00
parent b389854046
commit 359dc3b485
4 changed files with 42 additions and 8 deletions

View File

@@ -142,7 +142,7 @@ export interface IRestApi {
getCredentialTypes(): Promise<ICredentialType[]>;
getExecution(id: string): Promise<IExecutionResponse>;
deleteExecutions(sendData: IExecutionDeleteFilter): Promise<void>;
retryExecution(id: string): Promise<boolean>;
retryExecution(id: string, loadWorkflow?: boolean): Promise<boolean>;
getTimezones(): Promise<IDataObject>;
}

View File

@@ -91,9 +91,17 @@
</span>
</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">
<font-awesome-icon icon="redo" />
</el-button>
<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" />
</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>
</el-table-column>
@@ -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({

View File

@@ -263,8 +263,14 @@ export const restApi = Vue.extend({
},
// Returns the execution with the given name
retryExecution: (id: string): Promise<boolean> => {
return self.restApi().makeRestApiRequest('POST', `/executions/${id}/retry`);
retryExecution: (id: string, loadWorkflow?: boolean): Promise<boolean> => {
let sendData;
if (loadWorkflow === true) {
sendData = {
loadWorkflow: true,
};
}
return self.restApi().makeRestApiRequest('POST', `/executions/${id}/retry`, sendData);
},
// Returns all saved executions