From b80b2626a6ab16e75e2cb39d9c48d17a9a392a59 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Wed, 16 Dec 2020 23:08:35 +0100 Subject: [PATCH] web: fix rendering of version --- web/src/api/Versions.ts | 4 ---- web/src/pages/admin-overview/cards/AdminStatusCard.ts | 6 +++++- web/src/pages/admin-overview/cards/VersionStatusCard.ts | 6 +++++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/web/src/api/Versions.ts b/web/src/api/Versions.ts index c5735a54a..df75dc1d2 100644 --- a/web/src/api/Versions.ts +++ b/web/src/api/Versions.ts @@ -14,8 +14,4 @@ export class Version { return DefaultClient.fetch(["admin", "version"]); } - toString(): string { - return this.version_current; - } - } diff --git a/web/src/pages/admin-overview/cards/AdminStatusCard.ts b/web/src/pages/admin-overview/cards/AdminStatusCard.ts index c27c3afb3..e66304675 100644 --- a/web/src/pages/admin-overview/cards/AdminStatusCard.ts +++ b/web/src/pages/admin-overview/cards/AdminStatusCard.ts @@ -16,6 +16,10 @@ export abstract class AdminStatusCard extends AggregateCard { value?: T; + renderValue(): TemplateResult { + return html`${this.value}`; + } + renderInner(): TemplateResult { return html`

${until(this.getPrimaryValue().then((v) => { @@ -23,7 +27,7 @@ export abstract class AdminStatusCard extends AggregateCard { return this.getStatus(v); }).then((status) => { return html`

- ${this.value} + ${this.renderValue()}

${status.message ? html`

${status.message}

` : html``}`; }), html``)} diff --git a/web/src/pages/admin-overview/cards/VersionStatusCard.ts b/web/src/pages/admin-overview/cards/VersionStatusCard.ts index 458d23ec3..601518b17 100644 --- a/web/src/pages/admin-overview/cards/VersionStatusCard.ts +++ b/web/src/pages/admin-overview/cards/VersionStatusCard.ts @@ -1,5 +1,5 @@ import { gettext } from "django"; -import { customElement } from "lit-element"; +import { customElement, html, TemplateResult } from "lit-element"; import { Version } from "../../../api/Versions"; import { AdminStatusCard, AdminStatus } from "./AdminStatusCard"; @@ -24,4 +24,8 @@ export class VersionStatusCard extends AdminStatusCard { } } + renderValue(): TemplateResult { + return html`${this.value?.version_current}`; + } + }