web/admin: show GeoIP information inline in events
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
parent
a1be924fa4
commit
d1aa1f46da
|
@ -3,6 +3,7 @@ import { ActionToLabel } from "@goauthentik/admin/events/utils";
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import { EventWithContext } from "@goauthentik/common/events";
|
import { EventWithContext } from "@goauthentik/common/events";
|
||||||
import { uiConfig } from "@goauthentik/common/ui/config";
|
import { uiConfig } from "@goauthentik/common/ui/config";
|
||||||
|
import { KeyUnknown } from "@goauthentik/elements/forms/Form";
|
||||||
import { PaginatedResponse } from "@goauthentik/elements/table/Table";
|
import { PaginatedResponse } from "@goauthentik/elements/table/Table";
|
||||||
import { TableColumn } from "@goauthentik/elements/table/Table";
|
import { TableColumn } from "@goauthentik/elements/table/Table";
|
||||||
import { TablePage } from "@goauthentik/elements/table/TablePage";
|
import { TablePage } from "@goauthentik/elements/table/TablePage";
|
||||||
|
@ -55,6 +56,10 @@ export class EventListPage extends TablePage<Event> {
|
||||||
}
|
}
|
||||||
|
|
||||||
row(item: EventWithContext): TemplateResult[] {
|
row(item: EventWithContext): TemplateResult[] {
|
||||||
|
let geo: KeyUnknown | undefined = undefined;
|
||||||
|
if (Object.hasOwn(item.context, "geo")) {
|
||||||
|
geo = item.context.geo as KeyUnknown;
|
||||||
|
}
|
||||||
return [
|
return [
|
||||||
html`<div>${ActionToLabel(item.action)}</div>
|
html`<div>${ActionToLabel(item.action)}</div>
|
||||||
<small>${item.app}</small>`,
|
<small>${item.app}</small>`,
|
||||||
|
@ -67,7 +72,8 @@ export class EventListPage extends TablePage<Event> {
|
||||||
: html``}`
|
: html``}`
|
||||||
: html`-`,
|
: html`-`,
|
||||||
html`<span>${item.created?.toLocaleString()}</span>`,
|
html`<span>${item.created?.toLocaleString()}</span>`,
|
||||||
html`<span>${item.clientIp || t`-`}</span>`,
|
html` <div>${item.clientIp || t`-`}</div>
|
||||||
|
${geo ? html`<small>${geo.city}, ${geo.country}</small> ` : html``}`,
|
||||||
html`<span>${item.tenant?.name || t`-`}</span>`,
|
html`<span>${item.tenant?.name || t`-`}</span>`,
|
||||||
html`<a href="#/events/log/${item.pk}">
|
html`<a href="#/events/log/${item.pk}">
|
||||||
<i class="fas fa-share-square"></i>
|
<i class="fas fa-share-square"></i>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { AKElement } from "@goauthentik/elements/Base";
|
import { AKElement } from "@goauthentik/elements/Base";
|
||||||
|
import { KeyUnknown } from "@goauthentik/elements/forms/Form";
|
||||||
|
|
||||||
import { TemplateResult, html } from "lit";
|
import { TemplateResult, html } from "lit";
|
||||||
import { property } from "lit/decorators.js";
|
import { property } from "lit/decorators.js";
|
||||||
|
@ -25,10 +26,6 @@ export function readFileAsync(file: Blob) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export type KeyUnknown = {
|
|
||||||
[key: string]: unknown;
|
|
||||||
};
|
|
||||||
|
|
||||||
export class BaseStage<Tin, Tout> extends AKElement {
|
export class BaseStage<Tin, Tout> extends AKElement {
|
||||||
host!: StageHost;
|
host!: StageHost;
|
||||||
|
|
||||||
|
|
Reference in New Issue