From 96ff0ddf274e16c60440023c11441390537f3d1f Mon Sep 17 00:00:00 2001 From: Sohail Date: Mon, 23 Jun 2025 09:08:59 +0530 Subject: [PATCH] Enhanced the refresh functionality in targets route (#2889) * Enhanced the refresh functionality in targets and sessions route --- .../controllers/scopes/scope/projects/sessions/index.js | 4 ++-- .../app/controllers/scopes/scope/projects/targets/index.js | 4 ++-- .../app/routes/scopes/scope/projects/sessions/index.js | 7 ++++++- .../app/routes/scopes/scope/projects/targets/index.js | 7 ++++++- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ui/desktop/app/controllers/scopes/scope/projects/sessions/index.js b/ui/desktop/app/controllers/scopes/scope/projects/sessions/index.js index ca16bdf8e..ea5d4a1b4 100644 --- a/ui/desktop/app/controllers/scopes/scope/projects/sessions/index.js +++ b/ui/desktop/app/controllers/scopes/scope/projects/sessions/index.js @@ -150,7 +150,7 @@ export default class ScopesScopeProjectsSessionsIndexController extends Controll * Refreshes the all data for the current page. */ @action - refresh() { - this.send('refreshAll'); + async refresh() { + await this.currentRoute.refreshAll(); } } diff --git a/ui/desktop/app/controllers/scopes/scope/projects/targets/index.js b/ui/desktop/app/controllers/scopes/scope/projects/targets/index.js index c62c383d5..f2bbc7d9a 100644 --- a/ui/desktop/app/controllers/scopes/scope/projects/targets/index.js +++ b/ui/desktop/app/controllers/scopes/scope/projects/targets/index.js @@ -307,7 +307,7 @@ export default class ScopesScopeProjectsTargetsIndexController extends Controlle * Refreshes the all data for the current page. */ @action - refresh() { - this.send('refreshAll'); + async refresh() { + await this.currentRoute.refreshAll(); } } diff --git a/ui/desktop/app/routes/scopes/scope/projects/sessions/index.js b/ui/desktop/app/routes/scopes/scope/projects/sessions/index.js index 55c7b9bb9..5278cc346 100644 --- a/ui/desktop/app/routes/scopes/scope/projects/sessions/index.js +++ b/ui/desktop/app/routes/scopes/scope/projects/sessions/index.js @@ -177,6 +177,11 @@ export default class ScopesScopeProjectsSessionsIndexRoute extends Route { }); } + setupController(controller, model) { + super.setupController(controller, model); + controller.currentRoute = this; + } + resetController(controller, isExiting, transition) { const fromScope = transition.from.find( (routeInfo) => routeInfo.name === 'scopes.scope', @@ -212,6 +217,6 @@ export default class ScopesScopeProjectsSessionsIndexRoute extends Route { await this.store.query('scope', {}); // Refresh the proj scopes so our `modelFor` returns accurate data - this.router.refresh('scopes.scope.projects'); + await this.router.refresh('scopes.scope.projects'); } } diff --git a/ui/desktop/app/routes/scopes/scope/projects/targets/index.js b/ui/desktop/app/routes/scopes/scope/projects/targets/index.js index bf35a93e6..d6aff8ca8 100644 --- a/ui/desktop/app/routes/scopes/scope/projects/targets/index.js +++ b/ui/desktop/app/routes/scopes/scope/projects/targets/index.js @@ -243,6 +243,11 @@ export default class ScopesScopeProjectsTargetsIndexRoute extends Route { }); }; + setupController(controller, model) { + super.setupController(controller, model); + controller.currentRoute = this; + } + resetController(controller, isExiting, transition) { const fromScope = transition.from.find( (routeInfo) => routeInfo.name === 'scopes.scope', @@ -269,6 +274,6 @@ export default class ScopesScopeProjectsTargetsIndexRoute extends Route { await this.store.query('scope', {}); // Refresh the proj scopes so our `modelFor` returns accurate data - this.router.refresh('scopes.scope.projects'); + await this.router.refresh('scopes.scope.projects'); } }