Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui): try retrieving live workflow first then archived #12972

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -384,33 +384,30 @@ export function WorkflowDetails({history, location, match}: RouteComponentProps<
// Get workflow
useEffect(() => {
(async () => {
let archivedWf: Workflow;
if (uid !== '') {
try {
archivedWf = await services.workflows.getArchived(namespace, uid);
setError(null);
} catch (err) {
if (err.status !== 404) {
setError(err);
}
}
}

try {
const wf = await services.workflows.get(namespace, name);
setUid(wf.metadata.uid);
setWorkflow(wf);
setError(null);
agilgur5 marked this conversation as resolved.
Show resolved Hide resolved
// If we find live workflow which has same uid, we use live workflow.
if (!archivedWf || archivedWf.metadata.uid === wf.metadata.uid) {
setWorkflow(wf);
setUid(wf.metadata.uid);
} else {
setWorkflow(archivedWf);
}
return;
} catch (err) {
if (archivedWf) {
setWorkflow(archivedWf);
} else {
if (err.status !== 404 && uid === '') {
setError(err);
return;
}

try {
const archivedWf = await services.workflows.getArchived(namespace, uid);
setWorkflow(archivedWf);
setError(null);
return;
} catch (archiveErr) {
if (archiveErr.status === 500 && archiveErr.response.body.message === 'getting archived workflows not supported') {
setError(err);
return;
}

setError(archiveErr);
}
}
})();
Expand Down
Loading