web: fix rendering of version

This commit is contained in:
Jens Langhammer 2020-12-16 23:08:35 +01:00
parent 3b7bba5a62
commit b80b2626a6
3 changed files with 10 additions and 6 deletions

View File

@ -14,8 +14,4 @@ export class Version {
return DefaultClient.fetch<Version>(["admin", "version"]); return DefaultClient.fetch<Version>(["admin", "version"]);
} }
toString(): string {
return this.version_current;
}
} }

View File

@ -16,6 +16,10 @@ export abstract class AdminStatusCard<T> extends AggregateCard {
value?: T; value?: T;
renderValue(): TemplateResult {
return html`${this.value}`;
}
renderInner(): TemplateResult { renderInner(): TemplateResult {
return html`<p class="center-value"> return html`<p class="center-value">
${until(this.getPrimaryValue().then((v) => { ${until(this.getPrimaryValue().then((v) => {
@ -23,7 +27,7 @@ export abstract class AdminStatusCard<T> extends AggregateCard {
return this.getStatus(v); return this.getStatus(v);
}).then((status) => { }).then((status) => {
return html`<p class="ak-aggregate-card"> return html`<p class="ak-aggregate-card">
<i class="${status.icon}"></i> ${this.value} <i class="${status.icon}"></i> ${this.renderValue()}
</p> </p>
${status.message ? html`<p class="subtext">${status.message}</p>` : html``}`; ${status.message ? html`<p class="subtext">${status.message}</p>` : html``}`;
}), html`<ak-spinner size="${SpinnerSize.Large}"></ak-spinner>`)} }), html`<ak-spinner size="${SpinnerSize.Large}"></ak-spinner>`)}

View File

@ -1,5 +1,5 @@
import { gettext } from "django"; import { gettext } from "django";
import { customElement } from "lit-element"; import { customElement, html, TemplateResult } from "lit-element";
import { Version } from "../../../api/Versions"; import { Version } from "../../../api/Versions";
import { AdminStatusCard, AdminStatus } from "./AdminStatusCard"; import { AdminStatusCard, AdminStatus } from "./AdminStatusCard";
@ -24,4 +24,8 @@ export class VersionStatusCard extends AdminStatusCard<Version> {
} }
} }
renderValue(): TemplateResult {
return html`${this.value?.version_current}`;
}
} }