stages/authenticator: add created, last_updated and last_used metadata (#10636)

* stages/authenticator: add created, last_updated and last_used metadata

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>

* lint

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>

* also show for users

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>

* set allow_null

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

---------

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
Co-authored-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Marc 'risson' Schmitt
2024-08-07 14:09:49 +02:00
committed by GitHub
parent 340106594e
commit d8c3b8bad2
11 changed files with 209 additions and 5 deletions

View File

@ -1,5 +1,6 @@
import { AndNext, DEFAULT_CONFIG } from "@goauthentik/common/api/config";
import { deviceTypeName } from "@goauthentik/common/labels";
import { getRelativeTime } from "@goauthentik/common/utils";
import "@goauthentik/elements/buttons/Dropdown";
import "@goauthentik/elements/buttons/ModalButton";
import "@goauthentik/elements/buttons/TokenCopyButton";
@ -48,6 +49,8 @@ export class MFADevicesPage extends Table<Device> {
return [
msg("Name"),
msg("Type"),
msg("Created at"),
msg("Last used at"),
""
].map((th) => new TableColumn(th, ""));
}
@ -122,6 +125,12 @@ export class MFADevicesPage extends Table<Device> {
return [
html`${item.name}`,
html`${deviceTypeName(item)}`,
html`<div>${getRelativeTime(item.created)}</div>
<small>${item.created.toLocaleString()}</small>`,
html`${item.lastUsed
? html`<div>${getRelativeTime(item.lastUsed)}</div>
<small>${item.lastUsed.toLocaleString()}</small>`
: html`-`}`,
html`
<ak-forms-modal>
<span slot="submit">${msg("Update")}</span>