Phase 2: device registry, dashboard cards, manual lock/unlock, audit

- Device registry: add/edit name, child and platform, persisted in devices.
- Stable per-device topic derived from name + id, unchanged by renames.
- Desired state persisted in state; timed locks expire and are audited.
- Dashboard cards: name, child, platform, status dot, state and time left.
- Manual lock/unlock forms with CSRF; every change appends to audit (FR-15).
- Append-only activity list on the dashboard. No hard deletes (rule 10).
- Store and handler tests; version bumped to 0.2.0-phase2.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
2026-10-13 14:18:02 +11:00
parent c83c9df0a3
commit 7c88d3f52b
15 changed files with 1674 additions and 60 deletions

View File

@@ -27,21 +27,39 @@
<main class="container">
<header class="page-head">
<h1 class="heading-1">Dashboard</h1>
<p class="page-head__sub">Phase 1 skeleton — the Control Service is up and answering.</p>
<p class="page-head__sub">Lock or unlock a device. State is saved in SQLite and written to the audit log.</p>
</header>
{{if .Flash}}<p class="flash flash--ok" role="status">{{.Flash}}</p>{{end}}
{{if .ErrMsg}}<p class="flash flash--error" role="alert">{{.ErrMsg}}</p>{{end}}
{{template "status.html" .}}
<section class="section" aria-labelledby="devices-title">
<div class="section__head">
<h2 id="devices-title" class="heading-2">Devices</h2>
<span class="category-pill"><span class="dot dot--faint"></span>0 registered</span>
<div class="section__actions">
<span class="category-pill"><span class="dot dot--faint"></span>{{len .Devices}} registered</span>
<a class="button-primary" href="/devices/new">Add device</a>
</div>
</div>
<div class="empty-state">
<p class="empty-state__title">No devices yet</p>
<p class="empty-state__body">Device registration arrives in Phase 2. Until then the
dashboard, session login and <code>/health</code> are the working pieces.</p>
{{if .Devices}}
{{template "device-cards.html" .}}
{{else}}
<div class="empty-state">
<p class="empty-state__title">No devices yet</p>
<p class="empty-state__body">Add Harry's phone or Finn's computer to give it a name,
a child, and a platform. Nothing is enforced until a later phase.</p>
</div>
{{end}}
</section>
<section class="section" aria-labelledby="audit-title">
<div class="section__head">
<h2 id="audit-title" class="heading-2">Activity</h2>
<span class="category-pill">append-only audit</span>
</div>
{{template "audit-list.html" .}}
</section>
</main>