web: further cleanup, more linting
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import { gettext } from "django";
|
||||
import { css, CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element";
|
||||
import { ifDefined } from "lit-html/directives/if-defined";
|
||||
import { COMMON_STYLES } from "../../common/styles";
|
||||
|
||||
@customElement("pb-aggregate-card")
|
||||
@ -33,7 +34,7 @@ export class AggregateCard extends LitElement {
|
||||
return html`<div class="pf-c-card pf-c-card-aggregate">
|
||||
<div class="pf-c-card__header pf-l-flex pf-m-justify-content-space-between">
|
||||
<div class="pf-c-card__header-main">
|
||||
<i class="${this.icon}"></i> ${this.header ? gettext(this.header) : ""}
|
||||
<i class="${ifDefined(this.icon)}"></i> ${this.header ? gettext(this.header) : ""}
|
||||
</div>
|
||||
${this.headerLink ? html`<a href="${this.headerLink}">
|
||||
<i class="fa fa-external-link-alt"> </i>
|
||||
|
||||
@ -1,24 +1,26 @@
|
||||
import { customElement, html, property, TemplateResult } from "lit-element";
|
||||
import { until } from "lit-html/directives/until";
|
||||
import { AggregateCard } from "./AggregateCard";
|
||||
import "../Spinner";
|
||||
import { SpinnerSize } from "../Spinner";
|
||||
|
||||
@customElement("pb-aggregate-card-promise")
|
||||
export class AggregatePromiseCard extends AggregateCard {
|
||||
@property()
|
||||
promise?: Promise<string>;
|
||||
@property({attribute: false})
|
||||
promise?: Promise<Record<string, unknown>>;
|
||||
|
||||
promiseProxy(): Promise<TemplateResult> {
|
||||
if (!this.promise) {
|
||||
return new Promise<TemplateResult>(() => html``);
|
||||
}
|
||||
return this.promise.then(s => {
|
||||
return html`<i class="fa fa-check-circle"></i> ${s}`;
|
||||
return html`<i class="fa fa-check-circle"></i> ${s.toString()}`;
|
||||
});
|
||||
}
|
||||
|
||||
renderInner(): TemplateResult {
|
||||
return html`<p class="center-value">
|
||||
${until(this.promiseProxy(), html`<pb-spinner size="large"></pb-spinner>`)}
|
||||
${until(this.promiseProxy(), html`<pb-spinner size="${SpinnerSize.Large}"></pb-spinner>`)}
|
||||
</p>`;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user