From 235d283defd7317ba8e53c94c89aa687efcdd1b4 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sun, 28 Nov 2021 21:03:24 +0100 Subject: [PATCH] web/elements: use in ak-label instead of attribute Signed-off-by: Jens Langhammer --- web/src/elements/Label.ts | 8 ++----- .../crypto/CertificateKeyPairListPage.ts | 11 +++++++--- web/src/pages/outposts/OutpostHealth.ts | 21 ++++++++----------- web/src/pages/outposts/OutpostHealthSimple.ts | 9 ++++---- .../outposts/ServiceConnectionListPage.ts | 12 ++++------- .../pages/system-tasks/SystemTaskListPage.ts | 8 +++---- web/src/pages/users/UserViewPage.ts | 2 -- 7 files changed, 31 insertions(+), 40 deletions(-) diff --git a/web/src/elements/Label.ts b/web/src/elements/Label.ts index ba1f20936..0d836dfce 100644 --- a/web/src/elements/Label.ts +++ b/web/src/elements/Label.ts @@ -20,9 +20,6 @@ export class Label extends LitElement { @property() icon?: string; - @property() - text?: string; - static get styles(): CSSResult[] { return [PFBase, PFLabel, AKGlobal]; } @@ -47,12 +44,11 @@ export class Label extends LitElement { - ${this.text || ""} + `; } diff --git a/web/src/pages/crypto/CertificateKeyPairListPage.ts b/web/src/pages/crypto/CertificateKeyPairListPage.ts index 74c3ac56b..b676b9f89 100644 --- a/web/src/pages/crypto/CertificateKeyPairListPage.ts +++ b/web/src/pages/crypto/CertificateKeyPairListPage.ts @@ -10,6 +10,7 @@ import { CertificateKeyPair, CryptoApi } from "@goauthentik/api"; import { AKResponse } from "../../api/Client"; import { DEFAULT_CONFIG } from "../../api/Config"; import { uiConfig } from "../../common/config"; +import { PFColor } from "../../elements/Label"; import "../../elements/buttons/SpinnerButton"; import "../../elements/forms/DeleteBulkForm"; import "../../elements/forms/ModalForm"; @@ -92,9 +93,13 @@ export class CertificateKeyPairListPage extends TablePage { row(item: CertificateKeyPair): TemplateResult[] { return [ html`${item.name}`, - html`${item.privateKeyAvailable ? t`Yes` : t`No`}`, - html`${item.certExpiry?.toLocaleString()}`, - html` + html` + ${item.privateKeyAvailable ? t`Yes` : t`No`} + `, + html` new Date() ? PFColor.Green : PFColor.Orange}> + ${item.certExpiry?.toLocaleString()} + `, + html` ${t`Update`} ${t`Update Certificate-Key Pair`} diff --git a/web/src/pages/outposts/OutpostHealth.ts b/web/src/pages/outposts/OutpostHealth.ts index 476a7c74b..64e43934d 100644 --- a/web/src/pages/outposts/OutpostHealth.ts +++ b/web/src/pages/outposts/OutpostHealth.ts @@ -26,21 +26,18 @@ export class OutpostHealthElement extends LitElement { } return html`
  • - + + ${t`Last seen: ${this.outpostHealth.lastSeen?.toLocaleTimeString()}`} +
  • ${this.outpostHealth.versionOutdated - ? html`` - : html``} + ? html`${t`${this.outpostHealth.version}, should be ${this.outpostHealth.versionShould}`} + ` + : html`${t`Version: ${this.outpostHealth.version || ""}`} + `}
`; } diff --git a/web/src/pages/outposts/OutpostHealthSimple.ts b/web/src/pages/outposts/OutpostHealthSimple.ts index 6131df78f..293a37811 100644 --- a/web/src/pages/outposts/OutpostHealthSimple.ts +++ b/web/src/pages/outposts/OutpostHealthSimple.ts @@ -58,11 +58,10 @@ export class OutpostHealthSimpleElement extends LitElement { return html``; } if (!this.outpostHealth) { - return html``; + return html`${t`Not available`}`; } - return html` `; + return html` + ${t`Last seen: ${this.outpostHealth.lastSeen?.toLocaleTimeString()}`}`; } } diff --git a/web/src/pages/outposts/ServiceConnectionListPage.ts b/web/src/pages/outposts/ServiceConnectionListPage.ts index ba35eec8b..ba81b1008 100644 --- a/web/src/pages/outposts/ServiceConnectionListPage.ts +++ b/web/src/pages/outposts/ServiceConnectionListPage.ts @@ -73,15 +73,11 @@ export class OutpostServiceConnectionListPage extends TablePage { if (state.healthy) { - return html``; + return html`${ifDefined(state.version)}`; } - return html``; + return html`${t`Unhealthy`}`; }), html``, )}`, diff --git a/web/src/pages/system-tasks/SystemTaskListPage.ts b/web/src/pages/system-tasks/SystemTaskListPage.ts index ce28367d7..8940ee402 100644 --- a/web/src/pages/system-tasks/SystemTaskListPage.ts +++ b/web/src/pages/system-tasks/SystemTaskListPage.ts @@ -68,13 +68,13 @@ export class SystemTaskListPage extends TablePage { taskStatus(task: Task): TemplateResult { switch (task.status) { case StatusEnum.Successful: - return html``; + return html`${t`Successful`}`; case StatusEnum.Warning: - return html``; + return html`${t`Warning`}`; case StatusEnum.Error: - return html``; + return html`${t`Error`}`; default: - return html``; + return html`${t`Unknown`}`; } } diff --git a/web/src/pages/users/UserViewPage.ts b/web/src/pages/users/UserViewPage.ts index 4f3a5086c..67fc2227c 100644 --- a/web/src/pages/users/UserViewPage.ts +++ b/web/src/pages/users/UserViewPage.ts @@ -161,7 +161,6 @@ export class UserViewPage extends LitElement { color=${this.user.isActive ? PFColor.Green : PFColor.Orange} - text="" > @@ -178,7 +177,6 @@ export class UserViewPage extends LitElement { color=${this.user.isSuperuser ? PFColor.Green : PFColor.Orange} - text="" >