Skip to content

Commit

Permalink
fix(ui): don't reload the page until _after_ deletion (argoproj#11711)
Browse files Browse the repository at this point in the history
  • Loading branch information
agilgur5 authored Sep 4, 2023
1 parent 8e01696 commit 9e7dc25
Showing 1 changed file with 35 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,36 +189,44 @@ export const WorkflowDetails = ({history, location, match}: RouteComponentProps<
if (workflowOperation.title === 'DELETE') {
popup
.confirm('Confirm', () => <DeleteCheck isWfInDB={isArchivedWorkflow(workflow)} isWfInCluster={isWorkflowInCluster(workflow)} />)
.then(yes => {
if (yes) {
if (isWorkflowInCluster(workflow)) {
services.workflows.delete(workflow.metadata.name, workflow.metadata.namespace).catch(setError);
}
if (isArchivedWorkflow(workflow) && (globalDeleteArchived || !isWorkflowInCluster(workflow))) {
services.workflows.deleteArchived(workflow.metadata.uid, workflow.metadata.namespace).catch(setError);
}
if (error === null) {
navigation.goto(uiUrl(`workflows/${workflow.metadata.namespace}`));
// TODO: This is a temporary workaround so that the list of workflows
// is correctly displayed. Workflow list page needs to be more responsive.
window.location.reload();
}
.then(async yes => {
if (!yes) {
return;
}

const allPromises = [];
if (isWorkflowInCluster(workflow)) {
allPromises.push(services.workflows.delete(workflow.metadata.name, workflow.metadata.namespace).catch(setError));
}
if (isArchivedWorkflow(workflow) && (globalDeleteArchived || !isWorkflowInCluster(workflow))) {
allPromises.push(services.workflows.deleteArchived(workflow.metadata.uid, workflow.metadata.namespace).catch(setError));
}
await Promise.all(allPromises);
if (error !== null) {
return;
}

navigation.goto(uiUrl(`workflows/${workflow.metadata.namespace}`));
// TODO: This is a temporary workaround so that the list of workflows
// is correctly displayed. Workflow list page needs to be more responsive.
window.location.reload();
});
} else if (workflowOperation.title === 'RESUBMIT') {
setSidePanel('resubmit');
} else if (workflowOperation.title === 'RETRY') {
setSidePanel('retry');
} else {
popup.confirm('Confirm', `Are you sure you want to ${workflowOperation.title.toLowerCase()} this workflow?`).then(yes => {
if (yes) {
workflowOperation
.action(workflow)
.then((wf: Workflow) => {
setName(wf.metadata.name);
})
.catch(setError);
if (!yes) {
return;
}

workflowOperation
.action(workflow)
.then((wf: Workflow) => {
setName(wf.metadata.name);
})
.catch(setError);
});
}
}
Expand Down Expand Up @@ -476,11 +484,13 @@ export const WorkflowDetails = ({history, location, match}: RouteComponentProps<

const renderResumePopup = () => {
return popup.confirm('Confirm', renderSuspendNodeOptions).then(yes => {
if (yes) {
updateOutputParametersForNodeIfRequired()
.then(resumeNode)
.catch(setError);
if (!yes) {
return;
}

updateOutputParametersForNodeIfRequired()
.then(resumeNode)
.catch(setError);
});
};

Expand Down

0 comments on commit 9e7dc25

Please sign in to comment.