generated from coulomb/repo-seed
dashboard: move live indicator to TOC sidebar on all pages; add live-data docs
- All four pages (index, workstreams, decisions, progress) now inject the
live indicator into #observablehq-toc via injectTocTop("live-indicator", el)
Left-aligned (no text-align: right), position:relative + padding-right for
the ? button affordance
- decisions.md: splits the former combined "decisions-sidebar" widget into two
separate injectTocTop calls — KPI box first (ends lower), live indicator
second (ends at top); both now have their own stable ids
- withDocHelp(_liveEl, "/docs/live-data") wires the ? button on every page
- src/docs/live-data.md: new documentation page explaining poll interval (15s),
indicator colour semantics, offline recovery, and which endpoints each page hits
- Removes the .live-bar CSS class from all pages; replaces with .live-indicator
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
62
dashboard/src/docs/live-data.md
Normal file
62
dashboard/src/docs/live-data.md
Normal file
@@ -0,0 +1,62 @@
|
||||
---
|
||||
title: Live Data — Reference
|
||||
---
|
||||
|
||||
# Live Data — How the Dashboard Refreshes
|
||||
|
||||
All dashboard pages poll the State Hub API automatically. No manual refresh is ever needed.
|
||||
|
||||
---
|
||||
|
||||
## Poll interval
|
||||
|
||||
Every page fetches fresh data from `http://127.0.0.1:8000` every **15 seconds** using an async generator loop. The previous data stays visible while the next request is in flight, so the UI never goes blank.
|
||||
|
||||
---
|
||||
|
||||
## The live indicator
|
||||
|
||||
The **●** dot in the top-right corner of each page shows the current connection state:
|
||||
|
||||
| Indicator | Meaning |
|
||||
|---|---|
|
||||
| **● Live · updated HH:MM:SS** | Last poll succeeded — data is current as of that time |
|
||||
| **● Offline — run: `make api`** | API is unreachable — the dot turns red |
|
||||
|
||||
The timestamp updates on every successful poll. If you see a time that is more than ~30 seconds in the past, the poll is stalled (browser tab backgrounded or network issue) — reloading the page resets the loop.
|
||||
|
||||
---
|
||||
|
||||
## Offline recovery
|
||||
|
||||
If the API goes offline while you are viewing a page:
|
||||
|
||||
1. The indicator turns red immediately on the next failed poll (within 15 s)
|
||||
2. The last successfully loaded data stays visible
|
||||
3. Once the API restarts, the indicator turns green on the next poll — **no page reload needed**
|
||||
|
||||
To restart the API:
|
||||
|
||||
```bash
|
||||
cd ~/the-custodian/state-hub
|
||||
make api # starts uvicorn on 127.0.0.1:8000
|
||||
# or, if postgres is not running:
|
||||
make start # db + migrate + api
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Which data each page polls
|
||||
|
||||
| Page | Endpoints |
|
||||
|---|---|
|
||||
| Overview | `/state/summary` |
|
||||
| Workstreams | `/workstreams/`, `/topics/`, `/state/summary` |
|
||||
| Decisions | `/decisions/?limit=500`, `/topics/` |
|
||||
| Progress | `/progress/?limit=500` |
|
||||
|
||||
All endpoints are read-only GET requests. The dashboard never writes to the API.
|
||||
|
||||
---
|
||||
|
||||
*Poll interval: 15 s. Data is refreshed in the background — the page never reloads itself.*
|
||||
Reference in New Issue
Block a user