From cbf2e360ceccabfcc7f03acf57e55ff86383e941 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Mon, 26 Oct 2020 19:44:23 -0400 Subject: [PATCH] =?UTF-8?q?refactor:=20=F0=9F=92=A1=20scope=20route=20shou?= =?UTF-8?q?ld=20load=20project=20scopes=20too?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/core/app/routes/scopes/scope.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/ui/core/app/routes/scopes/scope.js b/ui/core/app/routes/scopes/scope.js index f0911b566..39ba70dfa 100644 --- a/ui/core/app/routes/scopes/scope.js +++ b/ui/core/app/routes/scopes/scope.js @@ -38,15 +38,19 @@ export default class ScopesScopeRoute extends Route { } /** - * Load all scopes within the current scope context. For example, - * if **this** scope is a project, attempt to load all projects for the owning - * org, as well as all orgs. If **this** scope is an org, attempt to load all - * orgs within the global scope. These are used for scope navigation. + * Load all scopes within the current scope context. Always attempt to load + * org scopes. Only attempt to load project scopes if the current scope is + * a project. These are used for scope navigation. */ - async afterModel() { - this.scopes = await hash({ + async afterModel(model) { + const scopes = { orgs: this.store.query('scope', { scope_id: 'global' }).catch(() => A([])) - }); + }; + if (model.isProject) { + this.projects = this.store.query('scope', { scope_id: model.scopeID }) + .catch(() => A([])) + } + this.scopes = await hash(scopes); } /**