feat(frontend): always-visible gun bays, idle/plugged/charging lamp language, self-service password

- Control renders every gun declared in the chargers registry, even when
  the charger is offline or has not reported that connector yet (state
  shows Offline / No status yet in gray)
- owner-specified state language: gray = idle, pulsing blue = cable in
  the socket (Preparing), green = charging; suspended/finishing = steady
  blue; fault = red
- POST /api/me/password (requires current password) + /account page,
  username in the topbar links to it
- smoke test: 58 checks (password change round-trip incl. old-password
  invalidation)
This commit is contained in:
2026-07-12 08:37:20 +02:00
parent 75869364b0
commit 3387f8689e
11 changed files with 229 additions and 48 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ backend/ (run: venv\Scripts\python -m backend.main, from the repo root)
- `ws://<host>:9000/<ChargerID>` — OCPP WebSocket (catch-all path, the JC-6620 dials in)
- `GET /` — **the [[frontend|React panel]]** served from `../frontend/dist/` with SPA fallback (deep links land on index.html; `/api/*` + `/docs` excluded; 503 with instructions if not built)
- `POST /api/login|logout`, `GET /api/me` — username/password → 30-day session (cookie + bearer)
- `POST /api/login|logout`, `GET /api/me`, `POST /api/me/password` (self-service change, current password required) — username/password → 30-day session (cookie + bearer)
- `GET /api/sessions?limit&cp&connector` — **charging history: who / when / kWh** (visibility: own sessions + guns within scope; admin sees all); `GET /api/sessions/{tx}/samples` — per-minute energy/power/SoC for charts
- `GET /api/status` — connected chargers, gun states, active transactions, auth events + pending-card count (admin), relays (filtered to what the caller may control)
- `GET /api/events?limit&event=` — tail the journal (admin)
+3 -2
View File
@@ -18,7 +18,8 @@ The React control panel (built 2026-07-11, replacing the single-file vanilla-JS
| Route | Who | What |
|---|---|---|
| `/` (Control) | all | one "bay" card per gun (labels from the chargers registry): status lamp, Start/Stop gated by scope **and** gun readiness; live session shows who/via/duration; relay toggles with on-demand live read |
| `/` (Control) | all | one "bay" card per gun — **every registry-declared gun always renders**, even offline; status lamp, Start/Stop gated by scope **and** gun readiness; live session shows who/via/duration; relay toggles with on-demand live read |
| `/account` | all | self-service password change (current password required) |
| `/history` | all (filtered by scope) | the audit table: **who charged, via Card or In-app, which gun, when, duration, kWh**; total kWh; live sessions flagged |
| `/cards` | admin | **pending cards awaiting review** (approve → name + owner + gun restrictions in one step; reject → silenced), enrolled cards with owner/guns editing, rejected list with un-reject |
| `/users` | admin | user CRUD with the **permission matrix** — admin toggle, per-gun and per-relay checkboxes rendered from `GET /api/permissions` (no raw scope strings in the UI) |
@@ -27,4 +28,4 @@ An amber **notification banner + nav badge** appears for admins whenever unknown
## Design
Instrument-panel direction grounded in the hardware: porcelain/graphite surfaces (light + dark via `prefers-color-scheme`), **copper-busbar accent**, IBM Plex Mono for telemetry/identifiers, Archivo for UI. Signature element: the **indicator lamp** (radial LED with glow) encoding state everywhere — green=available, pulsing green=charging, amber=preparing/pending, red=fault/denied. Reduced motion respected; keyboard focus visible.
Instrument-panel direction grounded in the hardware: porcelain/graphite surfaces (light + dark via `prefers-color-scheme`), **copper-busbar accent**, IBM Plex Mono for telemetry/identifiers, Archivo for UI. Signature element: the **indicator lamp** (radial LED with glow) encoding state everywhere, in the owner-specified language (2026-07-12): **gray = idle, pulsing blue = cable in the socket, green = charging**, red = fault/offline banner, amber = pending cards. Reduced motion respected; keyboard focus visible.