Files
Umbraco-CMS/src/Umbraco.Web.UI.Client/src/apps/app/app-oauth.element.ts
Jacob Overgaard 2383fbcd70 V15: Show a loader during the login procedures rather than oddly styled content (#17618)
* feat: show only a loader on a default login flow

if the flow fails, the app-error component will be shown, or if the flow is initialised inside a popup (i.e. the session was lost)

* fix: hasOwnOpener did not recognize the local vite url as its own pathname

it should work better by checking the `startsWith` comparing the pathname, and besides, it seems to work better for the understanding of the function to inverse the true/false check

* chore: adjust imports

* chore: formatting
2024-11-25 16:32:02 +00:00

46 lines
1.3 KiB
TypeScript

import { html, customElement, property } from '@umbraco-cms/backoffice/external/lit';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import './app-error.element.js';
/**
* A full page error element that can be used either solo or for instance as the error 500 page and BootFailed
*/
@customElement('umb-app-oauth')
export class UmbAppOauthElement extends UmbLitElement {
/**
* Set to true if the login failed. A message will be shown instead of the loader.
* @attr
*/
@property({ type: Boolean })
failure = false;
override render() {
// If we have a message, we show the error page
// this is most likely happening inside a popup
if (this.failure) {
return html`<umb-app-error
.errorHeadline=${this.localize.term('general_login')}
.errorMessage=${this.localize.term('errors_externalLoginFailed')}
hide-back-button></umb-app-error>`;
}
// If we don't have a message, we show the loader, this is most likely happening in the main app
// for the normal login flow
return html`
<umb-body-layout id="loader" style="align-items:center;">
<uui-loader></uui-loader>
</umb-body-layout>
`;
}
}
export default UmbAppOauthElement;
declare global {
interface HTMLElementTagNameMap {
'umb-app-oauth': UmbAppOauthElement;
}
}