hyperhive/frontend/packages/dashboard/src/logs.html
iris 8b991b2cc5 feat(dashboard): AUD1T — privileged-actions audit trail as a LOGS sub-tab
Adds an AUDIT sub-tab to /logs.html (alongside BUILD / AGENT / SYSTEM),
consuming GET /api/audit-log ({ entries, total }). A read-only filterable
table: when / agent / action / target / outcome / detail, newest-first,
with a 'latest 500 of N' header from total and a client-side substring
filter. Outcome badges colour ok green / err red, with an err whose detail
starts 'denied:' rendered amber + labelled 'denied' (capability refusal
reads distinct from an execution failure). Lazy-fetched on tab show (like
SYSTEM); a 30s ticker keeps the relative timestamps honest.

The audit_log store + endpoint landed in the prior audit-log backend work;
this is the operator-visible surface for it. Resolves #1647.
2026-06-13 15:31:50 +02:00

104 lines
4.7 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>hyperhive // LOGS</title>
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
<link rel="stylesheet" href="/static/colors.css">
<link rel="stylesheet" href="/static/theme.css">
<link rel="stylesheet" href="/static/common.css">
<link rel="stylesheet" href="/static/logs.css">
</head>
<body class="logs-shell">
<!-- Minimal chrome: back link + sub-tab strip.
Same pattern as flow.html — no full dashboard tabbar. Back link
points to the H0M3 hub (served at /), not the dashboard. -->
<header class="page-header">
<a class="page-back" href="/">← home</a>
<nav class="hive-tabbar logs-tabbar" id="logs-tabbar" role="tablist">
<a class="hive-tab" id="logs-tab-build" href="#build" role="tab"
aria-controls="logs-pane-build" data-tab="build">
<span class="logs-tab-label">BUILD</span>
</a>
<a class="hive-tab" id="logs-tab-agent" href="#agent" role="tab"
aria-controls="logs-pane-agent" data-tab="agent">
<span class="logs-tab-label">AGENT</span>
</a>
<a class="hive-tab" id="logs-tab-system" href="#system" role="tab"
aria-controls="logs-pane-system" data-tab="system">
<span class="logs-tab-label">SYSTEM</span>
</a>
<a class="hive-tab" id="logs-tab-audit" href="#audit" role="tab"
aria-controls="logs-pane-audit" data-tab="audit">
<span class="logs-tab-label">AUDIT</span>
</a>
</nav>
</header>
<main class="logs-main">
<!-- BUILD: all-agents build log history. Lists recent nix build /
nixos-container invocations across all agents, with
click-to-expand full stdout+stderr. Backed by
GET /api/build-logs?limit=30. -->
<section class="logs-pane" id="logs-pane-build" data-tab-pane="build"
role="tabpanel" aria-labelledby="logs-tab-build">
<div class="logs-toolbar">
<button type="button" class="btn btn-restart" id="build-refresh">↻ refresh</button>
</div>
<div id="build-list"><p class="meta">loading…</p></div>
</section>
<!-- AGENT: journald viewer for a specific agent container.
Agent selector + unit filter + line count. Backed by
GET /api/journal/{agent}?unit=<unit>&lines=N. -->
<section class="logs-pane" id="logs-pane-agent" data-tab-pane="agent"
role="tabpanel" aria-labelledby="logs-tab-agent">
<div class="logs-toolbar">
<select id="agent-select" class="journal-unit"></select>
<select id="agent-unit-select" class="journal-unit">
<option value="hive-ag3nt.service">hive-ag3nt.service</option>
<option value="">(full machine journal)</option>
</select>
<button type="button" class="btn btn-restart" id="agent-refresh">↻ refresh</button>
<span id="agent-fetch-ts" class="meta logs-fetch-ts" hidden></span>
</div>
<pre id="agent-output" class="journal-output">select an agent above</pre>
</section>
<!-- SYSTEM: host-side service logs. Shows the hive-c0re daemon
journal via GET /api/journal-host?unit=hive-c0re.service. -->
<section class="logs-pane" id="logs-pane-system" data-tab-pane="system"
role="tabpanel" aria-labelledby="logs-tab-system">
<div class="logs-toolbar">
<select id="system-unit-select" class="journal-unit">
<option value="hive-c0re.service">hive-c0re.service</option>
</select>
<button type="button" class="btn btn-restart" id="system-refresh">↻ refresh</button>
<span id="system-fetch-ts" class="meta logs-fetch-ts" hidden></span>
</div>
<pre id="system-output" class="journal-output">loading…</pre>
</section>
<!-- AUDIT: operator-visible trail of agent-initiated privileged
actions (infra-container restarts, etc.). Filterable table backed
by GET /api/audit-log ({ entries, total }), newest first, server
clamped to the latest 500. -->
<section class="logs-pane" id="logs-pane-audit" data-tab-pane="audit"
role="tabpanel" aria-labelledby="logs-tab-audit">
<div class="logs-toolbar">
<input type="text" id="audit-filter" class="audit-filter"
placeholder="filter agent / action / target / detail…" autocomplete="off">
<button type="button" class="btn btn-restart" id="audit-refresh">↻ refresh</button>
<span id="audit-count" class="meta"></span>
</div>
<div id="audit-list"><p class="meta">loading…</p></div>
</section>
</main>
<script type="module" src="/static/logs.js" defer></script>
</body>
</html>