web: cleanup messages implementation (#386)

* web: rebuild messages without template objects

* web: show error message when ws connection fails

* web: show error message when siteshell page not found

* web: fix spinner size for loading

* web: fix linting error
This commit is contained in:
Jens L
2020-12-12 20:46:02 +01:00
committed by GitHub
parent 488e8f769a
commit 0a874c98cb
10 changed files with 108 additions and 57 deletions

View File

@ -6,6 +6,8 @@ import SpinnerStyle from "@patternfly/patternfly/components/Spinner/spinner.css"
// @ts-ignore
import BackdropStyle from "@patternfly/patternfly/components/Backdrop/backdrop.css";
import { SpinnerSize } from "../../elements/Spinner";
import { showMessage } from "../../elements/messages/MessageContainer";
import { gettext } from "django";
@customElement("ak-site-shell")
export class SiteShell extends LitElement {
@ -64,6 +66,10 @@ export class SiteShell extends LitElement {
}
console.debug(`authentik/site-shell: Request failed ${this._url}`);
window.location.hash = "#/";
showMessage({
level_tag: "error",
message: gettext(`Request failed: ${r.statusText}`),
});
throw new Error("Request failed");
})
.then((r) => r.text())
@ -115,7 +121,7 @@ export class SiteShell extends LitElement {
html`<div class="pf-c-backdrop">
<div class="pf-l-bullseye">
<div class="pf-l-bullseye__item">
<ak-spinner size=${SpinnerSize.Large}></ak-spinner>
<ak-spinner size=${SpinnerSize.XLarge}></ak-spinner>
</div>
</div>
</div>`