Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
2a6ca69
Start squad record for feature 217
claude Nov 28, 2026
00ffbd9
Add spec draft and log for feature 217
claude Nov 28, 2026
47e1aa2
Finish spec for feature 217
claude Nov 28, 2026
dd0c4ea
Log spec challenge
claude Nov 28, 2026
d0e7864
Revise spec after challenge
claude Nov 28, 2026
6d36b47
Add plan, tasks and decision records
claude Nov 28, 2026
72876cc
Log plan security review
claude Nov 28, 2026
3cb9e67
Append plan challenge notes
claude Nov 28, 2026
45db92e
Add G1 tests (work in progress)
claude Nov 28, 2026
3b7bcbf
Add G1 tests first
claude Nov 28, 2026
5487725
Implement G1 palette and card styles
claude Nov 28, 2026
ea376b3
Tick G1 tasks
claude Nov 28, 2026
c60267c
Add G2 tests (work in progress)
claude Nov 28, 2026
326305c
Add G2 tests first
claude Nov 28, 2026
c67756a
Implement G2 icons, header, bars, network rows
claude Nov 28, 2026
b948962
Add deferred G2 tests
claude Nov 28, 2026
5da7e07
Add G3 tests (work in progress)
claude Nov 28, 2026
c1dc09d
Add G3 tests first
claude Nov 28, 2026
ad5eaa4
Implement G3 sparkline, gauge and documentation
claude Nov 28, 2026
6969ee5
Log documentation step
claude Nov 28, 2026
4a0968b
Tick G3 tasks
claude Nov 28, 2026
f461630
Reduce test complexity (work in progress)
claude Nov 28, 2026
277fa2b
Reduce test complexity
claude Nov 28, 2026
de6fb12
Gate stamp passes
claude Nov 28, 2026
31da0f1
Manual check and test documentation
claude Nov 28, 2026
a477555
Gate stamp passes on new head
claude Nov 28, 2026
a4258ac
Log review round 1
claude Nov 28, 2026
1c9c3e6
Narrow the touch-target sentence in dashboard.md
claude Nov 28, 2026
90b0928
Log review decision
claude Nov 28, 2026
9cc6dad
Apply review round 1 fixes
claude Nov 28, 2026
36a928f
Gate stamp passes after review fixes
claude Nov 28, 2026
9415343
Log delta review
claude Nov 28, 2026
82b0a91
Accept decision records 0038-0040
claude Nov 28, 2026
9dbbbde
Stamp record status
claude Nov 28, 2026
99005d9
Remove squad working record
claude Nov 28, 2026
89c586b
Fix SonarQube findings in assets and tests
claude Nov 28, 2026
308b2e5
Fix stale parameter name in test comment
claude Nov 28, 2026
568f2e4
Fix heading typography of clickable cards (work in progress)
claude Nov 28, 2026
3a3aa2e
Fix S8193 in the heading typography test and note Sonar-only rules
claude Nov 28, 2026
d2d08c1
Use the plain download and upload arrows of the issue (work in progress)
claude Nov 28, 2026
095c36b
Add a focus ring to the header buttons (work in progress)
claude Nov 28, 2026
fda0d8a
Soft halo hover for the header buttons (work in progress)
claude Nov 28, 2026
4ccff36
Soft halo hover for the header buttons
claude Nov 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .squad/stack.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ after the PR is open. `gocognit` also counts the bare `if err != nil` check, whi
existing function over the limit, add a named exclusion in `.golangci.yml` and note it in `.squad/project.md`.
Other SonarQube Cloud findings (and hotspots, duplication) have no local Go equivalent: the *Sonar gate* below reports their issues and hotspots and the quality gate, duplication
included, on the draft pull request.
Sonar rules not reported locally, with how to avoid them while writing code:
- `go:S8193` (unnecessary variable declaration): a variable declared in an `if` init statement that is used only in the
condition. Write the expression directly in the condition, e.g. `if normCSS(v) != "inherit" {`.
- `go:S978` (identifier shadows a predeclared identifier): do not name a parameter or variable `min`, `max`, `len`,
`cap`, `new`, `copy`, `string`, `error` and the like; use a qualified name such as `minCount`.

Changed shell scripts (`*.sh`), GitHub workflows (`.github/workflows/*.yml`) and Dockerfiles are checked with
`shellcheck`, `actionlint` and `hadolint`; the SessionStart hook installs the three as pinned, checksum-verified
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ automation systems like openHAB). Runs as a systemd service.
transition, so alerts reach Slack, Discord, Home Assistant, ntfy, etc.
Delivery is fully off the collection path, so a slow webhook never blocks
metric sampling
- **Light/dark theme toggle** - follows the OS setting by default, with a
- **Light/dark mode toggle** - follows the OS setting by default, with a
manual override remembered in the browser
- **Configurable dashboard layout** - show/hide and reorder metric cards
from a settings modal, remembered in the browser
Expand Down
2 changes: 1 addition & 1 deletion docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ under [`areas/`](areas/README.md); this document links them instead of repeating
- [HTTP API](areas/http-api.md) β€” routes and when they are registered, authentication, compression, caching, the
concurrency limit, security headers, `/healthz`, Prometheus, server stats, TLS and timeouts.
- [Dashboard](areas/dashboard.md) β€” asset serving and caching, polling, the history merge, API key handling,
rendering, coloring, alert badges, layout and theme.
rendering, coloring, alert badges, layout, mode and look.
- [openHAB](areas/openhab.md) β€” detecting a local openHAB, its states and values, the poll cadence, the loopback-only
requests and the handling of its API token.
- [Configuration](areas/configuration.md) β€” sources and their precedence, every option with its default and valid
Expand Down
3 changes: 3 additions & 0 deletions docs/UNIT_TESTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ not be merged; see the checklist in [`.github/pull_request_template.md`](../.git
only their key set. A JS test framework is
deliberately not part of this repository (see below), and these scans are the only way to
guard client-side behavior that unit tests can't reach.
`internal/web/palette_test.go` pins the dashboard's colour tokens and the contrast ratio of each text and
background pair, and `internal/web/icons_test.go` scans the assets for emoji, so no symbol stands in for an
inline SVG icon.

4. **Integration / hardware tests**

Expand Down
2 changes: 1 addition & 1 deletion docs/areas/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ operator or another component can rely on β€” formats, limits, error behavior, g
| [Alerts](alerts.md) | Thresholds, debounce, `ok`/`warn`/`crit` states, `fired`/`cleared` events, vanished resources, what `GET /api/v1/alerts` reports | Delivery to webhooks ([Notifications](notifications.md)) |
| [Notifications](notifications.md) | Webhook delivery: payload and templates, severity filter, per-webhook queues, retries, rate limit, timeouts, logging | When an alert fires ([Alerts](alerts.md)) |
| [HTTP API](http-api.md) | Routes and server-wide rules: versioning, API key, compression, caching, concurrency limit, security headers, TLS, `/healthz`, `/metrics`, server stats, timeouts | Per-endpoint JSON shapes ([`API.md`](../API.md)), the web UI ([Dashboard](dashboard.md)) |
| [Dashboard](dashboard.md) | The web UI: asset serving, polling, hidden-tab pause, API key prompt and browser storage, rendering, value coloring, theme, card layout | Headers and CSP ([HTTP API](http-api.md)), data shapes ([`API.md`](../API.md)) |
| [Dashboard](dashboard.md) | The web UI: asset serving, polling, hidden-tab pause, API key prompt and browser storage, rendering, value coloring, mode and look, card layout | Headers and CSP ([HTTP API](http-api.md)), data shapes ([`API.md`](../API.md)) |
| [Configuration](configuration.md) | Config sources and precedence (file, `PIMONITOR_API_KEY`, flags), parsing rules, every option with type, default and valid range, startup failure | What an option does in its area (the area document) |
| [Deployment](deployment.md) | Release archive, `download-latest.sh`, `install.sh`, the systemd units and their privileges, the root apt timer, data directory, process lifecycle, upgrades | Release builds and tags ([`CONTRIBUTING.md`](../CONTRIBUTING.md)), threat model ([`SECURITY.md`](../../SECURITY.md)) |
| [openHAB](openhab.md) | The status of a local openHAB: detection, states, the values and their sources, poll cadence, request limits and the loopback guard, logging, the API token | The response shape ([`API.md`](../API.md)), the card ([Dashboard](dashboard.md)), option ranges ([Configuration](configuration.md)) |
Expand Down
34 changes: 29 additions & 5 deletions docs/areas/dashboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

The web UI served at `/`: how its assets are delivered, which API endpoints it reads and how often, how it handles
a configured API key, failures and hidden tabs, how it renders server data, colors values and shows alerts, and the
per-browser preferences (theme, card layout) it keeps. The user viewing the Pi in a browser relies on it; it is a
per-browser preferences (mode, card layout) it keeps. The user viewing the Pi in a browser relies on it; it is a
client of the [HTTP API](http-api.md) like any third-party integration and has no server-side state of its own.

## Behavior
Expand Down Expand Up @@ -192,16 +192,38 @@ client of the [HTTP API](http-api.md) like any third-party integration and has n
element that opened it on close. Except for the API key dialog, Escape, a click outside the dialog or its close
button closes it.

### Theme
### Mode

- The page has a light and a dark palette. With no stored choice it follows the operating system's
- The page has a light and a dark palette (the two modes). With no stored choice it follows the operating system's
`prefers-color-scheme` and follows live changes of it.
- The theme button switches to the other palette and stores the choice under `pimonitor-theme` (`light` or `dark`)
- The mode button switches to the other palette and stores the choice under `pimonitor-theme` (`light` or `dark`)
in `localStorage`; from then on the stored choice wins over the operating system setting. The page offers no
control to return to following the operating system.
- A stored choice is applied before the first paint, so the page never flashes the other palette. Charts and gauges
are redrawn in the new palette immediately on a switch.

### Look

- Every color comes from a token of the palette blocks of `style.css` (light, explicit dark and OS dark, the two
dark blocks identical); no rule outside them holds a color literal. Both the text and the fills of the page use
these tokens, so a mode switch changes tokens only.
- Status text (values, percentages, badges, the alert banner, the API-key error) uses the `*-ink` variant of
`ok`/`warn`/`crit`; bar fills and the card border of an alerting card use the base color. Text on an accent fill
uses `--on-accent`.
- A bar label shows the percentage emphasised, colored only at `warn` and `crit`, and the byte sizes muted beside it.
- The load gauge draws a 9 px arc on the `--track` color and shows its value inside the arc; the value's font size
scales with the gauge width.
- A sparkline is a 2 px line with a fill that fades towards the bottom and a dot with a ring at the newest point,
inset so the dot is never clipped.
- A card's own color appears only on its 28 px icon chip and on the hover/focus highlight of a clickable card; cards
have no colored top border. Clickable cards end their heading with a chevron.
- Icons are inline SVG drawn in `currentColor`, hidden from assistive technology; the page uses no emoji. The mode
button shows the moon in light mode and the sun in dark mode, chosen by CSS. The network card names its rates
Download and Upload for screen readers next to the arrow icons.
- The header buttons, the heading buttons of clickable cards, the updates button and the dialog buttons (close,
range, move, reset, unlock) are at least 44 px high, and 44 px wide where icon-only. The text and status colors
reach a contrast of 4.5:1 on their backgrounds in both modes, guarded by a test (`palette_test.go`).

### Card layout

- The cards are System, Updates, Uptime, CPU Usage, Load Average, Temperature, Memory & Swap, Filesystems,
Expand Down Expand Up @@ -238,7 +260,9 @@ client of the [HTTP API](http-api.md) like any third-party integration and has n

## Related decisions

None yet.
- [0038](../decisions/0038-dashboard-mode-and-theme-as-token-overrides.md): mode and theme as token overrides
- [0039](../decisions/0039-card-colour-only-on-icon-chip.md): card colour only on the icon chip
- [0040](../decisions/0040-dashboard-icons-inline-svg.md): inline SVG icons

## Not here

Expand Down
38 changes: 38 additions & 0 deletions docs/decisions/0038-dashboard-mode-and-theme-as-token-overrides.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 0038: Dashboard "mode" is light or dark, a "theme" is a set of custom-property overrides

- **Status:** Accepted
- **Date:** 2026-11-28
- **Area:** Dashboard
- **Source:** Issue #217
- **Supersedes:** β€”

## Context

Until v1.4 the dashboard called its light/dark palette switch the "theme" (`pimonitor-theme`, `data-theme`, the
header button). Issue #217 introduces the visual design Clear, and later issues of the v1.5.0 milestone add the
designs Console and Berry and a selection between them, each in a light and a dark variant. Two concepts now need two
names, and each design has to be swappable without touching the markup or the scripts. The page runs under
`style-src 'self'`, so no style can be injected at run time.

## Options considered

1. **"Mode" for light/dark, "theme" for the design; every colour, radius, shadow, padding and gap a custom property
on `:root`, defined in a light block and two identical dark blocks** β€” a theme becomes a set of overrides of
these properties; canvas widgets read the same properties when they draw. Cost: more tokens, and the two dark
blocks must be kept identical (guarded by a test).
2. **Keep "theme" for light/dark and call the designs "skins"** β€” no rename in the documentation. Cost: the stored
key and the attribute keep a name that no longer matches the user-facing concept of the milestone's issues.
3. **One stylesheet per design** β€” each design free in its rules. Cost: three copies of every layout rule to keep in
step, more embedded bytes on a Pi Zero, and a design switch that reloads a stylesheet.

## Decision

Option 1. Light/dark is the *mode*; its storage key `pimonitor-theme` and attribute `data-theme` keep their names,
since renaming them would reset every stored choice. The look is described in
[Dashboard](../areas/dashboard.md#look); the per-card colours are tokens of the palette blocks like every other
colour.

## Consequences

- A later theme only adds override blocks; `style.css` holds no colour literal outside the palette blocks.
- The stored key keeps the old word: code and documentation say "mode" and name the key as it is.
37 changes: 37 additions & 0 deletions docs/decisions/0039-card-colour-only-on-icon-chip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 0039: The per-card colour appears only on the icon chip; status colours have a fill and an ink variant

- **Status:** Accepted
- **Date:** 2026-11-28
- **Area:** Dashboard
- **Source:** Issue #217
- **Supersedes:** β€”

## Context

Every card had a 3 px top border in its own colour, so nine to ten strong colours competed with `ok`, `warn` and
`crit`, the colours that carry meaning. The status colours also served as text colours, and in light mode `#16a34a`
and `#d97706` on white reach only about 3.3:1 and 3.2:1, below the 4.5:1 that small text needs.

## Options considered

1. **Card colour only on a tinted icon chip and on the hover/focus highlight; a darker (light mode) or lighter (dark
mode) `*-ink` token per status level for text, the base token for fills** β€” the status colours stand out, text
reaches 4.5:1, fills keep their familiar hue. Cost: two tokens per level to keep consistent.
2. **Drop the per-card colours altogether** β€” calmest page. Cost: the cards lose the cue that tells them apart at a
glance, which the issue keeps.
3. **Darken the base status colours for everything** β€” one token per level. Cost: bar fills and gauge arcs turn
muddy in light mode, and dark mode needs the opposite shift.

## Decision

Option 1: no coloured card border; the card colour tints the icon chip and the highlight of clickable cards; text in
a status colour uses `--ok-ink`, `--warn-ink` or `--crit-ink`, fills use `--ok`, `--warn` or `--crit`. The rules are
in [Dashboard](../areas/dashboard.md#look).

## Consequences

- Every status rule for text is at least as specific as the rule that gives the element its default colour; until
this change the openHAB process-memory value and the `Things offline` toggle never showed their documented
colour because of that.
- A contrast test in `internal/web` computes the ratios from the parsed tokens, so a later palette edit cannot drop
below 4.5:1 unnoticed.
36 changes: 36 additions & 0 deletions docs/decisions/0040-dashboard-icons-inline-svg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# 0040: Dashboard icons are inline stroke SVG in the page, not emoji

- **Status:** Accepted
- **Date:** 2026-11-28
- **Area:** Dashboard
- **Source:** Issue #217
- **Supersedes:** β€”

## Context

The dashboard used emoji as icons. They render differently on every operating system and browser, cannot take a
palette colour and clash with the charts. The page must stay self-contained (`default-src 'self'`, `img-src 'self'
data:`, no inline style), embedded in the binary, small enough for a Pi Zero, and `app.js` must not build markup with
`innerHTML`.

## Options considered

1. **Inline `<svg>` at each use in `index.html`, drawn with `currentColor`; icons the script adds (the network
arrows) cloned from a `<template>` in the page** β€” colours follow the tokens, no request, no markup string in the
script. Cost: a repeated icon (the chevron) is repeated in the page, a few hundred bytes.
2. **An SVG sprite of `<symbol>`s referenced by `<use href="#…">`** β€” each icon once. Cost: an indirection for about
15 small icons, and tests must resolve references to check what a heading shows.
3. **Icon images or an icon font as extra embedded assets** β€” Cost: extra requests and files; an image cannot take
`currentColor`, a font is far larger than the icons.
4. **Keep emoji** β€” Cost: the problem of the issue.

## Decision

Option 1. The favicon stays a `data:` URI, now an SVG drawing in a fixed accent colour, since a favicon cannot read
the page's tokens. The rules (sizes, accessible names) are in [Dashboard](../areas/dashboard.md#look).

## Consequences

- A test scans `index.html` and `app.js` for emoji, escapes included, against a table of Unicode's
`Extended_Pictographic` ranges generated once with Node's ICU (the generator line stands in the test).
- The mode icon is chosen by CSS from the same selectors as the palette, so it is right before the first paint.
3 changes: 3 additions & 0 deletions docs/decisions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,7 @@ once in the [area document](../areas/README.md) of the record's area, and the re
| [0035](0035-float-duration-options-capped-at-seven-or-365-days.md) | The other float seconds and minutes options are capped at seven or 365 days | Accepted | 2026-11-28 |
| [0036](0036-poll-and-updates-intervals-at-least-one-unit.md) | The fast and slow collection intervals are at least one second and one minute | Accepted | 2026-11-28 |
| [0037](0037-apt-state-change-repeats-check-once.md) | install.sh refreshes apt before it starts the service, and a changed apt state repeats the check once | Accepted | 2026-11-28 |
| [0038](0038-dashboard-mode-and-theme-as-token-overrides.md) | Dashboard "mode" is light or dark, a "theme" is a set of custom-property overrides | Accepted | 2026-11-28 |
| [0039](0039-card-colour-only-on-icon-chip.md) | The per-card colour appears only on the icon chip; status colours have a fill and an ink variant | Accepted | 2026-11-28 |
| [0040](0040-dashboard-icons-inline-svg.md) | Dashboard icons are inline stroke SVG in the page, not emoji | Accepted | 2026-11-28 |
<!-- project:end index -->
Loading