Files
steward/internal/web/static/assets/pages/audit.js
T
abrown38andClaude Opus 5.5 3c0808591f Steward 0.1.0 (in development): a DHCPv4 server with a web UI, API and CLI
Subnets served per interface, pools, reservations, options at three
levels, leases in SQLite saved before the ACK, ping and decline conflict
checks, validated changes with history and undo, users and tokens, an
audit log, a Kea importer, a sandboxed systemd unit and Debian packages.
Tested with real udhcpc and dhcpcd clients in Docker (scripts/e2e.sh).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 12:14:07 +01:00

26 lines
1.4 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// The audit log: logins, users, tokens, changes, lease deletions.
import { h, mount, table, time, input, debounce, badge } from "../ui.js";
import { get } from "../api.js";
export async function render(el) {
const search = input({ type: "search", placeholder: "user, action, object or detail" });
const out = h("div");
const draw = async () => {
const q = search.value.trim();
const evs = await get("/audit", { q, limit: 300 });
mount(out, table([
{ label: "When", render: (e) => time(e.time) },
{ label: "User", render: (e) => [e.username || "–", e.auth ? h("span", { class: "muted small" }, " " + e.auth) : null] },
{ label: "From", render: (e) => h("span", { class: "mono small" }, e.ip || "") },
{ label: "Action", render: (e) => h("span", { class: "mono" }, e.action) },
{ label: "Object", render: (e) => e.object },
{ label: "Result", render: (e) => badge(e.result, e.result === "success" ? "ok" : "err") },
{ label: "Detail", render: (e) => h("span", { class: "small" }, e.detail) },
], evs, { empty: "Nothing logged" + (q ? " that matches." : " yet.") }));
};
search.addEventListener("input", debounce(draw, 300));
mount(el, h("div", { class: "page-head" }, h("div", { class: "grow" }, h("h1", null, "Audit log"))),
h("div", { class: "filter-row" }, search), h("div", { class: "panel" }, out));
await draw();
}