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

[ui] When a job is deleted in the background, wait until redirect before cache unload #23492

Merged
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions .changelog/23492.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
ui: Fix an issue where a remotely purged job would prevent redirect from taking place in the web UI
```
27 changes: 17 additions & 10 deletions ui/app/controllers/jobs/job.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,27 @@ export default class JobController extends Controller {
return this.model;
}

@action notFoundJobHandler() {
@action async notFoundJobHandler() {
if (
this.watchers.job.isError &&
this.watchers.job.error?.errors?.some((e) => e.status === '404')
) {
this.notifications.add({
title: `Job "${this.job.name}" has been deleted`,
message:
'The job you were looking at has been deleted; this is usually because it was purged from elsewhere.',
color: 'critical',
sticky: true,
});
this.store.unloadRecord(this.job);
this.router.transitionTo('jobs');
try {
this.notifications.add({
title: `Job "${this.job.name}" has been deleted`,
message:
'The job you were looking at has been deleted; this is usually because it was purged from elsewhere.',
color: 'critical',
sticky: true,
});
await this.router.transitionTo('jobs');
this.store.unloadRecord(this.job);
} catch (err) {
if (err.code === 'TRANSITION_ABORTED') {
return;
}
throw err;
}
}
}
}
Loading