From 7c48d20887c4fee31595ff2a672507c90f874661 Mon Sep 17 00:00:00 2001 From: Phil Renaud Date: Tue, 2 Jul 2024 16:54:34 -0400 Subject: [PATCH 1/2] Wait until the job page is moved-off before unloading the job from ember data cache --- ui/app/controllers/jobs/job.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/app/controllers/jobs/job.js b/ui/app/controllers/jobs/job.js index f1212e76440..daa81c70a2b 100644 --- a/ui/app/controllers/jobs/job.js +++ b/ui/app/controllers/jobs/job.js @@ -23,7 +23,7 @@ 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') @@ -35,8 +35,8 @@ export default class JobController extends Controller { color: 'critical', sticky: true, }); + await this.router.transitionTo('jobs'); this.store.unloadRecord(this.job); - this.router.transitionTo('jobs'); } } } From 16fb206702b7cf06edd3fed5362ed425c6bbcd43 Mon Sep 17 00:00:00 2001 From: Phil Renaud Date: Wed, 3 Jul 2024 09:40:28 -0400 Subject: [PATCH 2/2] handle transitionAborted error --- .changelog/23492.txt | 3 +++ ui/app/controllers/jobs/job.js | 25 ++++++++++++++++--------- 2 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 .changelog/23492.txt diff --git a/.changelog/23492.txt b/.changelog/23492.txt new file mode 100644 index 00000000000..e6538f39e27 --- /dev/null +++ b/.changelog/23492.txt @@ -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 +``` diff --git a/ui/app/controllers/jobs/job.js b/ui/app/controllers/jobs/job.js index daa81c70a2b..393ee25652f 100644 --- a/ui/app/controllers/jobs/job.js +++ b/ui/app/controllers/jobs/job.js @@ -28,15 +28,22 @@ export default class JobController extends Controller { 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, - }); - await this.router.transitionTo('jobs'); - this.store.unloadRecord(this.job); + 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; + } } } }