mirror of https://github.com/status-im/consul.git
ui: Misc SSO w/Namespace amends (#7851)
* ui: If an auth-method is in another namespace than default, make that clear * Pass through the namespace of the auth method rather than use the current * Make sure we refresh the application route, before redirecting This ensure that the nspaces and are refreshed in the main nav menu
This commit is contained in:
parent
319301abe8
commit
74f1a3917e
|
@ -90,7 +90,7 @@
|
|||
<State @matches="loading">
|
||||
<TokenSource
|
||||
@dc={{dc}}
|
||||
@nspace={{nspace}}
|
||||
@nspace={{or value.Namespace nspace}}
|
||||
@type={{if value.Name 'oidc' 'secret'}}
|
||||
@value={{if value.Name value.Name value}}
|
||||
@onchange={{action onsubmit}}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
type="button" class={{concat item.Kind '-oidc-provider'}}
|
||||
onclick={{action onchange item}}
|
||||
>
|
||||
Continue with {{or item.DisplayName item.Name}}
|
||||
Continue with {{or item.DisplayName item.Name}}{{#if (not-eq item.Namespace 'default')}} ({{item.Namespace}}){{/if}}
|
||||
</button>
|
||||
</li>
|
||||
{{/each}}
|
||||
|
@ -26,7 +26,9 @@
|
|||
@selected={{item}}
|
||||
@searchEnabled={{false}}
|
||||
@options={{items}} as |item|>
|
||||
<span class={{concat item.Kind '-oidc-provider'}}>{{or item.DisplayName item.Name}}</span>
|
||||
<span class={{concat item.Kind '-oidc-provider'}}>
|
||||
{{or item.DisplayName item.Name}}{{#if (not-eq item.Namespace 'default')}} ({{item.Namespace}}){{/if}}
|
||||
</span>
|
||||
</PowerSelect>
|
||||
</label>
|
||||
<button
|
||||
|
|
|
@ -44,13 +44,22 @@ export default Controller.extend({
|
|||
}
|
||||
const routeName = this.router.currentRoute.name;
|
||||
const route = getOwner(this).lookup(`route:${routeName}`);
|
||||
const router = this.router;
|
||||
// Refresh the application route
|
||||
return getOwner(this)
|
||||
.lookup('route:application')
|
||||
.refresh()
|
||||
.promise.then(() => {
|
||||
// We use transitionable here as refresh doesn't work if you are on an error page
|
||||
// which is highly likely to happen here (403s)
|
||||
if (routeName !== this.router.currentRouteName) {
|
||||
return route.transitionTo(...transitionable(this.router, params, getOwner(this)));
|
||||
if (routeName !== router.currentRouteName || typeof params.nspace !== 'undefined') {
|
||||
return route.transitionTo(
|
||||
...transitionable(router.currentRoute, params, getOwner(this))
|
||||
);
|
||||
} else {
|
||||
return route.refresh();
|
||||
}
|
||||
});
|
||||
},
|
||||
e.type,
|
||||
function(type, e) {
|
||||
|
|
Loading…
Reference in New Issue