feat(#986): dedicated logs page with build/agent/system sub-tabs

Add /logs.html as a standalone page (same back-link pattern as flow.html):
- BUILD tab: all-agents build log history via new GET /api/build-logs endpoint
- AGENT tab: per-container journald viewer with agent selector + unit filter
- SYSTEM tab: host-side hive-c0re.service logs via new GET /api/journal-host endpoint

Remove inline log drill-ins from SW4RM container rows (buildJournalTrigger
and buildBuildLogsTrigger) — log viewing now lives on the dedicated page.

flow.html: strip the full dashboard tabbar, replace with a simple back link
matching the new logs page chrome.

index.html: add L0GS tab link to /logs.html in the tab strip.

Backend additions:
- build_logs::list_recent_all — cross-agent query (newest first, cap 100)
- GET /api/build-logs — all-agents variant backed by list_recent_all
- GET /api/journal-host — host journald (no -M container flag), restricted
  to allow-listed units (hive-c0re.service)
This commit is contained in:
iris 2026-06-01 19:11:47 +02:00
commit 0b15cad93f
9 changed files with 534 additions and 299 deletions

View file

@ -0,0 +1,78 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>hyperhive // LOGS</title>
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
<link rel="stylesheet" href="/static/dashboard.css">
</head>
<body class="logs-shell">
<!-- Minimal chrome: back link + sub-tab strip.
Same pattern as flow.html — no full dashboard tabbar. -->
<header class="logs-header">
<a class="logs-back" href="/">← dashboard</a>
<nav class="logs-tabbar" id="logs-tabbar" role="tablist">
<a class="logs-tab" id="logs-tab-build" href="#build" role="tab"
aria-controls="logs-pane-build" data-logs-tab="build">
<span class="logs-tab-label">BUILD</span>
</a>
<a class="logs-tab" id="logs-tab-agent" href="#agent" role="tab"
aria-controls="logs-pane-agent" data-logs-tab="agent">
<span class="logs-tab-label">AGENT</span>
</a>
<a class="logs-tab" id="logs-tab-system" href="#system" role="tab"
aria-controls="logs-pane-system" data-logs-tab="system">
<span class="logs-tab-label">SYSTEM</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"
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"
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>
</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"
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>
</div>
<pre id="system-output" class="journal-output">loading…</pre>
</section>
</main>
<script type="module" src="/static/logs.js" defer></script>
</body>
</html>