Build on Phases 1–6. Telemetry already arrived on
restrict/<device>/telemetry; this phase stores it in a daily rollup and
shows it.
- store: migration 003 adds telemetry_daily (device, day, app seconds,
site seconds). InsertTelemetry maintains the affected days in the same
transaction; RebuildRollups backfills and repairs it. UsageRange and
TopUsage serve the week grid and top lists. CapAudit enforces the
size-capped append-only audit log from AGENTS.md §7.
- web: GET /devices/{id}/usage — Monday-to-Sunday totals plus the top 10
apps and top 10 sites, using CSP-safe native <progress> bars.
- theme.js: light/dark from the OS preference, with a nav toggle, loaded
as an external script so the strict CSP still holds.
- cmd/control: `rollup` subcommand; rollup rebuild and audit cap at
start-up and every 15 minutes.
- Version 0.5.0-phase7 (compose, Makefile, docs).
Tests: go test ./... and go vet ./... pass in golang:1.25-alpine.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
75 lines
2.7 KiB
HTML
75 lines
2.7 KiB
HTML
{{define "dashboard.html"}}<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<meta name="color-scheme" content="light dark">
|
|
<title>{{.Title}} — Internet Use Control</title>
|
|
<link rel="stylesheet" href="/static/tokens.css">
|
|
<link rel="stylesheet" href="/static/app.css">
|
|
<script src="/static/htmx.min.js" defer></script>
|
|
<script src="/static/theme.js" defer></script>
|
|
</head>
|
|
<body class="app">
|
|
<nav class="nav-bar">
|
|
<a class="nav-bar__brand" href="/">
|
|
<span class="nav-bar__mark" aria-hidden="true"></span>
|
|
Internet Use Control
|
|
</a>
|
|
<div class="nav-bar__right">
|
|
<button class="button-utility" type="button" data-theme-toggle>Dark</button>
|
|
<span class="nav-bar__user">{{.Username}}</span>
|
|
<form method="post" action="/logout" class="nav-bar__logout">
|
|
<input type="hidden" name="csrf" value="{{.CSRF}}">
|
|
<button class="button-utility" type="submit">Sign out</button>
|
|
</form>
|
|
</div>
|
|
</nav>
|
|
|
|
<main class="container">
|
|
<header class="page-head">
|
|
<h1 class="heading-1">Dashboard</h1>
|
|
<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>
|
|
<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>
|
|
{{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>
|
|
|
|
<footer class="app-foot">
|
|
<span>Control Service · {{.Version}} · {{.AppEnv}}</span>
|
|
<span class="app-foot__sep">·</span>
|
|
<span>{{year}} Family Home Lab</span>
|
|
</footer>
|
|
</body>
|
|
</html>{{end}}
|