import { gettext } from "django"; import { CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element"; import { AdminOverview } from "../../api/admin_overview"; import { DefaultClient } from "../../api/client"; import { User } from "../../api/user"; import { COMMON_STYLES } from "../../common/styles"; import { AggregatePromiseCard } from "../../elements/cards/AggregatePromiseCard"; @customElement("pb-admin-status-card") export class AdminStatusCard extends AggregatePromiseCard { @property() value?: number; @property() warningText?: string; @property() lessThanThreshold?: number; renderNone(): TemplateResult { return html``; } renderGood(): TemplateResult { return html`

${this.value}

`; } renderBad(): TemplateResult { return html`

${this.value}

${this.warningText ? gettext(this.warningText) : ""}

`; } renderInner(): TemplateResult { if (!this.value) { return this.renderNone(); } return html``; } } @customElement("pb-admin-overview") export class AdminOverviewPage extends LitElement { @property() data?: AdminOverview; @property() users?: Promise; static get styles(): CSSResult[] { return COMMON_STYLES; } firstUpdated(): void { AdminOverview.get().then(value => this.data = value); this.users = User.count(); } render(): TemplateResult { return html`

${gettext("System Overview")}

`; } }