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 { inject as service } from '@ember/service';
export default Route.extend({
router: service(),
init() {
setupController(controller) {
this._super(...arguments);
this.router.on('routeWillChange', (transition) => {
this.set('myTargetRouteName', transition.to.name);
});
},
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);
}
const targetRoute = location.pathname || '';
controller.set('isCallback', targetRoute.includes('oidc/callback'));
},
});

View File

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

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">
<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>
{{#in-element this.pageContainer}}
<OidcCallbackSplash />
{{/in-element}}

View File

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