static: re-add backdrop, format

This commit is contained in:
Jens Langhammer 2020-11-22 13:48:39 +01:00
parent 49899a9ceb
commit 37979291b5
6 changed files with 33 additions and 29 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,9 +1,7 @@
export interface User { export interface User {
pk: number; pk: number;
username: string; username: string;
name: string; name: string;
is_superuser: boolean; is_superuser: boolean;
email: boolean; email: boolean;
} }

View file

@ -11,11 +11,10 @@ import SpinnerStyle from "@patternfly/patternfly/components/Spinner/spinner.css"
const PRIMARY_CLASS = "pf-m-primary"; const PRIMARY_CLASS = "pf-m-primary";
const SUCCESS_CLASS = "pf-m-success"; const SUCCESS_CLASS = "pf-m-success";
const ERROR_CLASS = "pf-m-danger"; const ERROR_CLASS = "pf-m-danger";
const PROGRESS_CLASS ="pf-m-in-progress"; const PROGRESS_CLASS = "pf-m-in-progress";
@customElement("pb-action-button") @customElement("pb-action-button")
export class ActionButton extends LitElement { export class ActionButton extends LitElement {
@property() @property()
url: string = ""; url: string = "";
@ -23,7 +22,7 @@ export class ActionButton extends LitElement {
isRunning = false; isRunning = false;
static get styles() { static get styles() {
return [GlobalsStyle, ButtonStyle, SpinnerStyle] return [GlobalsStyle, ButtonStyle, SpinnerStyle];
} }
setLoading() { setLoading() {
@ -68,7 +67,10 @@ export class ActionButton extends LitElement {
} }
render() { render() {
return html`<button class="pf-c-button pf-m-progress ${this.classList}" @click=${() => this.callAction()}> return html`<button
class="pf-c-button pf-m-progress ${this.classList}"
@click=${() => this.callAction()}
>
${this.isRunning ${this.isRunning
? html` <span class="pf-c-button__progress"> ? html` <span class="pf-c-button__progress">
<span <span

View file

@ -122,15 +122,15 @@ export const ROOT_ITEMS: SidebarItem[] = [
path: "/audit/audit/", path: "/audit/audit/",
condition: (sb: SideBar) => { condition: (sb: SideBar) => {
return sb.user?.is_superuser!; return sb.user?.is_superuser!;
} },
}, },
{ {
name: "Administration", name: "Administration",
children: SIDEBAR_ITEMS, children: SIDEBAR_ITEMS,
condition: (sb: SideBar) => { condition: (sb: SideBar) => {
return sb.user?.is_superuser!; return sb.user?.is_superuser!;
} },
} },
]; ];
@customElement("pb-sidebar") @customElement("pb-sidebar")
@ -183,8 +183,8 @@ export class SideBar extends LitElement {
constructor() { constructor() {
super(); super();
fetch("/api/v2beta/core/users/me/") fetch("/api/v2beta/core/users/me/")
.then(r => r.json()) .then((r) => r.json())
.then(r => this.user = <User>r); .then((r) => (this.user = <User>r));
this.activePath = window.location.hash.slice(1, Infinity); this.activePath = window.location.hash.slice(1, Infinity);
window.addEventListener("hashchange", (e) => { window.addEventListener("hashchange", (e) => {
this.activePath = window.location.hash.slice(1, Infinity); this.activePath = window.location.hash.slice(1, Infinity);
@ -196,7 +196,9 @@ export class SideBar extends LitElement {
<a href="#/" class="pf-c-page__header-brand-link"> <a href="#/" class="pf-c-page__header-brand-link">
<div class="pf-c-brand pb-brand"> <div class="pf-c-brand pb-brand">
<img src="${this.brandLogo}" alt="passbook icon" /> <img src="${this.brandLogo}" alt="passbook icon" />
${this.brandTitle ? html`<span>${this.brandTitle}</span>` : ""} ${this.brandTitle
? html`<span>${this.brandTitle}</span>`
: ""}
</div> </div>
</a> </a>
</li>`; </li>`;

View file

@ -97,7 +97,8 @@ export class SiteShell extends LitElement {
render() { render() {
return html` ${this.loading return html` ${this.loading
? html` <div class="pf-l-bullseye"> ? html`<div class="pf-c-backdrop">
<div class="pf-l-bullseye">
<div class="pf-l-bullseye__item"> <div class="pf-l-bullseye__item">
<span <span
class="pf-c-spinner pf-m-xl" class="pf-c-spinner pf-m-xl"
@ -109,6 +110,7 @@ export class SiteShell extends LitElement {
<span class="pf-c-spinner__tail-ball"></span> <span class="pf-c-spinner__tail-ball"></span>
</span> </span>
</div> </div>
</div>
</div>` </div>`
: ""} : ""}
<slot name="body"> </slot>`; <slot name="body"> </slot>`;