diff --git a/addons/auth/addon/authenticators/password.js b/addons/auth/addon/authenticators/password.js index 814fffc22..7403eae65 100644 --- a/addons/auth/addon/authenticators/password.js +++ b/addons/auth/addon/authenticators/password.js @@ -64,7 +64,7 @@ export default class PasswordAuthenticator extends BaseAuthenticator { case 404: return reject(); } - return resolve(data); + return resolve(this.normalizeData(data)); } /** @@ -93,7 +93,20 @@ export default class PasswordAuthenticator extends BaseAuthenticator { const authEndpointURL = this.buildAuthEndpointURL(options); const response = await fetch(authEndpointURL, { method: 'post', body }); const json = await response.json(); - return response.status < 400 ? resolve(json) : reject(); + return response.status < 400 ? resolve(this.normalizeData(json)) : reject(); + } + + /** + * Normalizes the auth data. Adds convenience booleans depending on the + * scope within which the session is authenticated: isGlobal, isOrg. + * @param {object} data + * @return {object} + */ + normalizeData(data) { + // Add booleans indicated the scope type + data.isGlobal = (data?.scope?.type === 'global'); + data.isOrg = (data?.scope?.type === 'org'); + return data; } /** diff --git a/addons/rose/addon/styles/rose/components/dropdown/_button.scss b/addons/rose/addon/styles/rose/components/dropdown/_button.scss index 2fe195562..b15bb016e 100644 --- a/addons/rose/addon/styles/rose/components/dropdown/_button.scss +++ b/addons/rose/addon/styles/rose/components/dropdown/_button.scss @@ -6,8 +6,7 @@ display: block; box-sizing: border-box; width: 100%; - // Targeting min-width of ~200 - min-width: (sizing.rems(m)) * 10; + min-width: (sizing.rems(m)) * 13; border: 0; padding: 0 sizing.rems(s); text-decoration: none; diff --git a/addons/rose/addon/styles/rose/components/dropdown/_link.scss b/addons/rose/addon/styles/rose/components/dropdown/_link.scss index 6fd5d039f..695b2e4ba 100644 --- a/addons/rose/addon/styles/rose/components/dropdown/_link.scss +++ b/addons/rose/addon/styles/rose/components/dropdown/_link.scss @@ -6,8 +6,7 @@ display: block; box-sizing: border-box; width: 100%; - // Targeting min-width of ~200 - min-width: (sizing.rems(m)) * 10; + min-width: (sizing.rems(m)) * 13; border: 0; padding: 0 sizing.rems(s); text-decoration: none; diff --git a/ui/core/app/routes/scopes/scope.js b/ui/core/app/routes/scopes/scope.js index 2cbe96d88..ef8aa1273 100644 --- a/ui/core/app/routes/scopes/scope.js +++ b/ui/core/app/routes/scopes/scope.js @@ -38,6 +38,8 @@ export default class ScopesScopeRoute extends Route { * Set scope in application controller */ afterModel() { + const orgScopes = this.modelFor('scopes').filterBy('isOrg', true); + this.controllerFor('application').set('orgScopes', orgScopes); const scope = this.modelFor('scopes.scope'); this.controllerFor('application').set('scope', scope); } diff --git a/ui/core/app/styles/app.scss b/ui/core/app/styles/app.scss index 6a13be697..108e7c619 100644 --- a/ui/core/app/styles/app.scss +++ b/ui/core/app/styles/app.scss @@ -67,6 +67,12 @@ display: none; } + .rose-dropdown { + .rose-icon { + transform: scale(0.7); + } + } + &.loading { &::after { animation: gradient 1s linear infinite; diff --git a/ui/core/app/templates/application.hbs b/ui/core/app/templates/application.hbs index a40b1dcba..80472c19a 100644 --- a/ui/core/app/templates/application.hbs +++ b/ui/core/app/templates/application.hbs @@ -6,16 +6,34 @@ + {{#if this.session.isAuthenticated}} - - {{#if this.scope.isOrg}} - {{this.scope.displayName}} - {{/if}} - + {{#if this.scope.isOrg}} + + + {{#if this.session.data.authenticated.isGlobal}} + + {{t "titles.global"}} + + {{#each this.orgScopes as |scope|}} + + {{scope.displayName}} + + {{/each}} + {{else}} + + {{this.scope.displayName}} + + {{/if}} + + + {{/if}} @@ -29,7 +47,9 @@ + {{/if}} +