diff --git a/ui/core/app/routes/scopes/scope.js b/ui/core/app/routes/scopes/scope.js
index 39ba70dfa..4351e112d 100644
--- a/ui/core/app/routes/scopes/scope.js
+++ b/ui/core/app/routes/scopes/scope.js
@@ -1,6 +1,5 @@
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
-import { hash } from 'rsvp';
import { A } from '@ember/array';
export default class ScopesScopeRoute extends Route {
@@ -43,14 +42,22 @@ export default class ScopesScopeRoute extends Route {
* a project. These are used for scope navigation.
*/
async afterModel(model) {
- const scopes = {
- orgs: this.store.query('scope', { scope_id: 'global' }).catch(() => A([]))
- };
+ // First, load orgs and, if necessary, projects
+ let orgs, projects;
+ orgs = await this.store.query('scope', { scope_id: 'global' })
+ .catch(() => A([]));
if (model.isProject) {
- this.projects = this.store.query('scope', { scope_id: model.scopeID })
+ projects = await this.store.query('scope', { scope_id: model.scopeID })
.catch(() => A([]))
}
- this.scopes = await hash(scopes);
+ // Then pull out the "selected" scopes, if relevant
+ let selectedOrg, selectedProject;
+ if (model.isGlobal || model.isOrg) selectedOrg = model;
+ if (model.isProject) {
+ selectedProject = model;
+ selectedOrg = this.store.peekRecord('scope', model.scopeID);
+ }
+ this.scopes = { orgs, projects, selectedOrg, selectedProject };
}
/**
@@ -59,7 +66,8 @@ export default class ScopesScopeRoute extends Route {
*/
setupController(controller) {
super.setupController(...arguments);
- controller.setProperties({ scopes: this.scopes });
+ const scopes = this.scopes;
+ controller.setProperties({ scopes });
}
/**
@@ -74,7 +82,6 @@ export default class ScopesScopeRoute extends Route {
this.render('scopes/scope/-header-nav', {
into: 'application',
outlet: 'header-nav',
- model: model,
});
this.render('scopes/scope/-sidebar', {
diff --git a/ui/core/app/templates/scopes/scope/-header-nav.hbs b/ui/core/app/templates/scopes/scope/-header-nav.hbs
index be1e33452..02b952ec8 100644
--- a/ui/core/app/templates/scopes/scope/-header-nav.hbs
+++ b/ui/core/app/templates/scopes/scope/-header-nav.hbs
@@ -1,5 +1,5 @@
{{#if this.session.data.authenticated.isGlobal}}
@@ -18,3 +18,16 @@
{{/if}}
+
+{{#if this.scopes.selectedProject}}
+
+ {{#each this.scopes.projects as |scope|}}
+
+ {{scope.displayName}}
+
+ {{/each}}
+
+{{/if}}