web/admin: fix mismatched values in charts

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens Langhammer 2023-02-21 11:59:33 +01:00
parent 6c72c97513
commit 53c03f3635
No known key found for this signature in database
5 changed files with 6 additions and 11 deletions

View file

@ -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 .",

View file

@ -134,7 +134,7 @@ export class AdminOverviewPage extends AKElement {
>
<ak-aggregate-card
icon="pf-icon pf-icon-zone"
header=${t`Outpost status`}
header=${t`Outpost instance status`}
headerLink="#/outpost/outposts"
>
<ak-admin-status-chart-outpost></ak-admin-status-chart-outpost>

View file

@ -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<Event> {
}
row(item: EventWithContext): TemplateResult[] {
let geo: KeyUnknown | undefined = undefined;
if (Object.hasOwn(item.context, "geo")) {
geo = item.context.geo as KeyUnknown;
}
return [
html`<div><a href="${`#/events/log/${item.pk}`}">${ActionToLabel(item.action)}</a></div>
<small>${item.app}</small>`,
@ -92,7 +87,7 @@ export class RecentEventsCard extends Table<Event> {
: html`-`,
html`<span>${item.created?.toLocaleString()}</span>`,
html` <div>${item.clientIp || t`-`}</div>
${geo ? html`<small>${geo.city}, ${geo.country}</small> ` : html``}`,
<small>${EventGeo(item)}</small>`,
html`<span>${item.tenant?.name || t`-`}</span>`,
];
}

View file

@ -67,7 +67,7 @@ export class LDAPSyncStatusChart extends AKChart<LDAPSyncStats> {
);
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,
};

View file

@ -57,7 +57,7 @@ export class OutpostStatusChart extends AKChart<OutpostStats> {
);
this.centerText = outposts.pagination.count.toString();
return {
healthy: outposts.pagination.count === 0 ? -1 : healthy,
healthy: outposts.pagination.count === 0 ? 0 : healthy,
outdated,
unhealthy,
};