Skip to content

Commit

Permalink
feat: add retry button to archived workflow UI. Fixes argoproj#7908
Browse files Browse the repository at this point in the history
Signed-off-by: Dillen Padhiar <[email protected]>
  • Loading branch information
dpadhiar committed Mar 28, 2022
1 parent 745c325 commit 1caac2e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,22 @@ export class ArchivedWorkflowDetails extends BasePage<RouteComponentProps<any>,

public render() {
const items = [
{
title: 'Retry',
iconClassName: 'fa fa-undo',
disabled: false,
action: () => this.retryArchivedWorkflow()
},
{
title: 'Resubmit',
iconClassName: 'fa fa-redo',
disabled: false,
action: () => this.resubmitArchivedWorkflow()
},
{
title: 'Delete',
iconClassName: 'fa fa-trash',
disabled: false,
action: () => this.deleteArchivedWorkflow()
}
];
Expand All @@ -107,6 +115,7 @@ export class ArchivedWorkflowDetails extends BasePage<RouteComponentProps<any>,
items.push({
title: link.name,
iconClassName: 'fa fa-external-link-alt',
disabled: false,
action: () => this.openLink(link)
})
);
Expand Down Expand Up @@ -267,6 +276,27 @@ export class ArchivedWorkflowDetails extends BasePage<RouteComponentProps<any>,
services.archivedWorkflows
.resubmit(this.state.workflow.metadata.uid, this.state.workflow.metadata.namespace)
.then(workflow => (document.location.href = uiUrl(`workflows/${workflow.metadata.namespace}/${workflow.metadata.name}`)))
.catch(e => {
this.appContext.apis.notifications.show({
content: 'Failed to resubmit archived workflow ' + e,
type: NotificationType.Error
})
})
}

private retryArchivedWorkflow() {
if (!confirm('Are you sure you want to retry this archived workflow?')) {
return;
}
services.archivedWorkflows
.retry(this.state.workflow.metadata.uid, this.state.workflow.metadata.namespace)
.then(workflow => (document.location.href = uiUrl(`workflows/${workflow.metadata.namespace}/${workflow.metadata.name}`)))
.catch(e => {
this.appContext.apis.notifications.show({
content: 'Failed to retry archived workflow ' + e,
type: NotificationType.Error
})
})
}

private openLink(link: Link) {
Expand Down
7 changes: 7 additions & 0 deletions ui/src/app/shared/services/archived-workflows-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,11 @@ export class ArchivedWorkflowsService {
.send({namespace})
.then(res => res.body as models.Workflow);
}

public retry(uid: string, namespace: string) {
return requests
.put(`api/v1/archived-workflows/${uid}/retry`)
.send({namespace})
.then(res => res.body as models.Workflow);
}
}

0 comments on commit 1caac2e

Please sign in to comment.