Route renderTemplate Deprecation (#14646)

* removes renderTemplate usages

* adds _super to setupController override in oidc-callback route
This commit is contained in:
Jordan Reimer 2022-03-22 13:43:43 -06:00 committed by GitHub
parent da93aff7d4
commit dacb98ec91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 31 additions and 40 deletions

View File

@ -1,25 +1,9 @@
import Route from '@ember/routing/route'; import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
export default Route.extend({ export default Route.extend({
router: service(), setupController(controller) {
init() {
this._super(...arguments); this._super(...arguments);
this.router.on('routeWillChange', (transition) => { const targetRoute = location.pathname || '';
this.set('myTargetRouteName', transition.to.name); controller.set('isCallback', targetRoute.includes('oidc/callback'));
});
},
renderTemplate() {
let targetName = this.myTargetRouteName;
let isCallback =
targetName === 'vault.cluster.oidc-callback' || targetName === 'vault.cluster.oidc-callback-namespace';
if (isCallback) {
this.render('vault/cluster/oidc-callback', {
into: 'application',
outlet: 'main',
});
} else {
this._super(...arguments);
}
}, },
}); });

View File

@ -13,10 +13,8 @@ export default Route.extend({
let queryParams = { source, namespace, path, code, state }; let queryParams = { source, namespace, path, code, state };
window.opener.postMessage(queryParams, window.origin); window.opener.postMessage(queryParams, window.origin);
}, },
renderTemplate() { setupController(controller) {
this.render(this.templateName, { this._super(...arguments);
into: 'application', controller.set('pageContainer', document.querySelector('.page-container'));
outlet: 'main',
});
}, },
}); });

View File

@ -0,0 +1,14 @@
<div class="splash-page-container section is-flex-v-centered-tablet is-flex-1 is-fullwidth">
<div class="columns is-centered is-gapless is-fullwidth">
<div class="column is-4-desktop is-6-tablet">
<div class="has-text-grey has-bottom-margin-m has-current-color-fill">
<LogoEdition />
</div>
<AlertBanner
@type="success"
@title="Signing in with your OIDC provider..."
@message="This window will close automatically"
/>
</div>
</div>
</div>

View File

@ -1 +1,5 @@
<LogoSplash /> {{#if this.isCallback}}
<OidcCallbackSplash />
{{else}}
<LogoSplash />
{{/if}}

View File

@ -1,14 +1,3 @@
<div class="splash-page-container section is-flex-v-centered-tablet is-flex-1 is-fullwidth"> {{#in-element this.pageContainer}}
<div class="columns is-centered is-gapless is-fullwidth"> <OidcCallbackSplash />
<div class="column is-4-desktop is-6-tablet"> {{/in-element}}
<div class="has-text-grey has-bottom-margin-m has-current-color-fill">
<LogoEdition />
</div>
<AlertBanner
@type="success"
@title="Signing in with your OIDC provider..."
@message="This window will close automatically"
/>
</div>
</div>
</div>

View File

@ -52,7 +52,9 @@ export default Component.extend({
this.onChange(value); this.onChange(value);
}, },
handleKeyUp(name, value) { handleKeyUp(name, value) {
this.onKeyUp(name, value); if (this.onKeyUp) {
this.onKeyUp(name, value);
}
}, },
}, },
}); });