From 53c03f36351e747ee10d04fd16b178f7e221ce29 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Tue, 21 Feb 2023 11:59:33 +0100 Subject: [PATCH] web/admin: fix mismatched values in charts Signed-off-by: Jens Langhammer --- web/package.json | 2 +- web/src/admin/admin-overview/AdminOverviewPage.ts | 2 +- web/src/admin/admin-overview/cards/RecentEventsCard.ts | 9 ++------- .../admin/admin-overview/charts/LDAPSyncStatusChart.ts | 2 +- .../admin/admin-overview/charts/OutpostStatusChart.ts | 2 +- 5 files changed, 6 insertions(+), 11 deletions(-) diff --git a/web/package.json b/web/package.json index 049ff94c3..f78aee450 100644 --- a/web/package.json +++ b/web/package.json @@ -7,7 +7,7 @@ "extract": "lingui extract", "build": "lingui compile && rollup -c ./rollup.config.js", "build-proxy": "lingui compile && rollup -c ./rollup.proxy.js", - "watch": "lingui compile && rollup -c -w", + "watch": "lingui compile && node --max-old-space-size=8192 node_modules/.bin/rollup -c -w", "lint": "eslint . --max-warnings 0 --fix", "lit-analyse": "lit-analyzer src", "prettier-check": "prettier --check .", diff --git a/web/src/admin/admin-overview/AdminOverviewPage.ts b/web/src/admin/admin-overview/AdminOverviewPage.ts index c02222a0f..0d8ab4e99 100644 --- a/web/src/admin/admin-overview/AdminOverviewPage.ts +++ b/web/src/admin/admin-overview/AdminOverviewPage.ts @@ -134,7 +134,7 @@ export class AdminOverviewPage extends AKElement { > diff --git a/web/src/admin/admin-overview/cards/RecentEventsCard.ts b/web/src/admin/admin-overview/cards/RecentEventsCard.ts index 45997a47e..c9af2ddb2 100644 --- a/web/src/admin/admin-overview/cards/RecentEventsCard.ts +++ b/web/src/admin/admin-overview/cards/RecentEventsCard.ts @@ -1,5 +1,5 @@ import "@goauthentik/admin/events/EventInfo"; -import { ActionToLabel } from "@goauthentik/admin/events/utils"; +import { ActionToLabel, EventGeo } from "@goauthentik/admin/events/utils"; import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; import { EventWithContext } from "@goauthentik/common/events"; import { truncate } from "@goauthentik/common/utils"; @@ -7,7 +7,6 @@ import "@goauthentik/elements/Tabs"; import "@goauthentik/elements/buttons/Dropdown"; import "@goauthentik/elements/buttons/ModalButton"; import "@goauthentik/elements/buttons/SpinnerButton"; -import { KeyUnknown } from "@goauthentik/elements/forms/Form"; import { PaginatedResponse } from "@goauthentik/elements/table/Table"; import { Table, TableColumn } from "@goauthentik/elements/table/Table"; @@ -69,10 +68,6 @@ export class RecentEventsCard extends Table { } row(item: EventWithContext): TemplateResult[] { - let geo: KeyUnknown | undefined = undefined; - if (Object.hasOwn(item.context, "geo")) { - geo = item.context.geo as KeyUnknown; - } return [ html`
${ActionToLabel(item.action)}
${item.app}`, @@ -92,7 +87,7 @@ export class RecentEventsCard extends Table { : html`-`, html`${item.created?.toLocaleString()}`, html`
${item.clientIp || t`-`}
- ${geo ? html`${geo.city}, ${geo.country} ` : html``}`, + ${EventGeo(item)}`, html`${item.tenant?.name || t`-`}`, ]; } diff --git a/web/src/admin/admin-overview/charts/LDAPSyncStatusChart.ts b/web/src/admin/admin-overview/charts/LDAPSyncStatusChart.ts index fcb85605b..ae5643181 100644 --- a/web/src/admin/admin-overview/charts/LDAPSyncStatusChart.ts +++ b/web/src/admin/admin-overview/charts/LDAPSyncStatusChart.ts @@ -67,7 +67,7 @@ export class LDAPSyncStatusChart extends AKChart { ); this.centerText = sources.pagination.count.toString(); return { - healthy: sources.pagination.count === 0 ? -1 : metrics.healthy, + healthy: sources.pagination.count === 0 ? 0 : metrics.healthy, failed: metrics.failed, unsynced: metrics.unsynced, }; diff --git a/web/src/admin/admin-overview/charts/OutpostStatusChart.ts b/web/src/admin/admin-overview/charts/OutpostStatusChart.ts index 60c654043..169565da1 100644 --- a/web/src/admin/admin-overview/charts/OutpostStatusChart.ts +++ b/web/src/admin/admin-overview/charts/OutpostStatusChart.ts @@ -57,7 +57,7 @@ export class OutpostStatusChart extends AKChart { ); this.centerText = outposts.pagination.count.toString(); return { - healthy: outposts.pagination.count === 0 ? -1 : healthy, + healthy: outposts.pagination.count === 0 ? 0 : healthy, outdated, unhealthy, };