feat(web): Dashboard real data sources (#109) #123

Merged
timothy merged 3 commits from feat/109-dashboard-data into main 2026-07-04 21:20:38 +02:00
Owner

Summary

Replaces the ChicoryTV Dashboard prototype/stub data with real REST API sources.

Head SHA: 6a9f1e41a4dbeaaf5c620140aad91d3fc23cdcfe

Widget to endpoint mapping

  • Sidebar version: GET /api/version (appVersion)
  • Sidebar health dot: GET /api/health summary status
  • Channels tile: GET /api/channels count
  • Active playouts tile: GET /api/playouts totalCount
  • On air tile/cards: GET /api/channels/state filtered by onAir, joined to GET /api/channels for channel name/number; nowPlaying.title, startUtc, and finishUtc drive title/progress when present
  • Libraries tile: GET /api/media-sources, summed libraries.length
  • System health panel: GET /api/health rows from title, status, and detail

Health fetch policy

GET /api/health is demand-loaded only: once on app mount for the shell/dashboard health state, then only from the manual Refresh health action. No interval polling was added because the endpoint reruns the full health-check set per request.

Removed prototype-only content

  • Removed fabricated Recent activity feed.
  • Removed fabricated Release notes body.

Verification

  • cd web && npm ci
  • cd web && npm run lint
  • cd web && npm run typecheck
  • cd web && npm test -- --run src/App.test.tsx (19 passed)
  • cd web && npm run build
  • TZ=UTC dotnet build ErsatzTV.sln (passed; existing NU1903 and test nullable warnings only)
  • TZ=UTC dotnet test ErsatzTV.Tests/ErsatzTV.Tests.csproj --no-build -v minimal (368 passed)
  • TZ=UTC dotnet test ErsatzTV.Core.Tests/ErsatzTV.Core.Tests.csproj --no-build -v minimal (493 passed, 1 skipped)
  • PR CI for 6a9f1e41a4dbeaaf5c620140aad91d3fc23cdcfe: success for .NET build/test and EF migration integrity; image push skipped on PR

Live backend + Vite proxy sanity check was not run in this session; verification above covers typed web build/tests and backend regression tests.

Closes #109

## Summary Replaces the ChicoryTV Dashboard prototype/stub data with real REST API sources. Head SHA: `6a9f1e41a4dbeaaf5c620140aad91d3fc23cdcfe` ## Widget to endpoint mapping - Sidebar version: `GET /api/version` (`appVersion`) - Sidebar health dot: `GET /api/health` summary status - Channels tile: `GET /api/channels` count - Active playouts tile: `GET /api/playouts` `totalCount` - On air tile/cards: `GET /api/channels/state` filtered by `onAir`, joined to `GET /api/channels` for channel name/number; `nowPlaying.title`, `startUtc`, and `finishUtc` drive title/progress when present - Libraries tile: `GET /api/media-sources`, summed `libraries.length` - System health panel: `GET /api/health` rows from `title`, `status`, and `detail` ## Health fetch policy `GET /api/health` is demand-loaded only: once on app mount for the shell/dashboard health state, then only from the manual `Refresh health` action. No interval polling was added because the endpoint reruns the full health-check set per request. ## Removed prototype-only content - Removed fabricated Recent activity feed. - Removed fabricated Release notes body. ## Verification - `cd web && npm ci` - `cd web && npm run lint` - `cd web && npm run typecheck` - `cd web && npm test -- --run src/App.test.tsx` (19 passed) - `cd web && npm run build` - `TZ=UTC dotnet build ErsatzTV.sln` (passed; existing NU1903 and test nullable warnings only) - `TZ=UTC dotnet test ErsatzTV.Tests/ErsatzTV.Tests.csproj --no-build -v minimal` (368 passed) - `TZ=UTC dotnet test ErsatzTV.Core.Tests/ErsatzTV.Core.Tests.csproj --no-build -v minimal` (493 passed, 1 skipped) - PR CI for `6a9f1e41a4dbeaaf5c620140aad91d3fc23cdcfe`: success for `.NET build/test` and EF migration integrity; image push skipped on PR Live backend + Vite proxy sanity check was not run in this session; verification above covers typed web build/tests and backend regression tests. Closes #109
timothy added 1 commit 2026-07-04 20:52:51 +02:00
feat(web): wire dashboard to real API data
Build ErsatzTV Image / Build & test (.NET) (pull_request) Failing after 41s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Successful in 3m41s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Has been skipped
a6056f73d8
refs #109
timothy added 1 commit 2026-07-04 20:55:46 +02:00
fix(web): satisfy dashboard lint checks
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 4m14s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Successful in 4m48s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Has been skipped
6a9f1e41a4
refs #109
Author
Owner

Fable review — verdict: FIX-FIRST (fixes being applied in-session per user instruction, not bounced to Codex)

SUBSTANTIAL (1): health status contract mismatch. The backend emits exactly pass|fail|warn|info (Health/Mapper.cs GetStatus), but App.tsx matches error|failed|unhealthy and warning|degraded — fail/warn never match, so every real failing/warning check renders green and the sidebar dot reads Healthy forever. The tests masked it with fictional Healthy/Warning fixtures. Fix: match the four real values, give info a neutral (uncounted) presentation, rewrite fixtures with real strings + add a fail fixture.

NITS (4): duplicate /api/version fetch on mount (dead version field in DashboardData); Refresh-health button not disabled while in flight (double-click → 2 concurrent runs of the expensive endpoint); useDashboardHealthQuery missing the active unmount-guard idiom the other hooks use; ~13 lines of dead .ctv-activity-*/.ctv-release-* CSS.

Verified good: all six endpoint usages match the generated schemas exactly (incl. nullable nowPlaying narrowing, totalCount paging semantics, libraries[] nesting); health polling discipline clean (mount + manual refresh only, no intervals, fetch-count test); progress math guards non-finite dates, finish<=start, clamping; type safety solid (all types from components['schemas'], no any); scope clean (4 web-only files, v1.d.ts untouched); design-system tokens/components used throughout; on-air join is exactly what #109 asked for.

Fixes will be pushed to this branch and CI re-run before merge.

## Fable review — verdict: FIX-FIRST (fixes being applied in-session per user instruction, not bounced to Codex) **SUBSTANTIAL (1):** health status contract mismatch. The backend emits exactly `pass|fail|warn|info` (Health/Mapper.cs GetStatus), but App.tsx matches `error|failed|unhealthy` and `warning|degraded` — `fail`/`warn` never match, so every real failing/warning check renders green and the sidebar dot reads Healthy forever. The tests masked it with fictional `Healthy`/`Warning` fixtures. Fix: match the four real values, give `info` a neutral (uncounted) presentation, rewrite fixtures with real strings + add a `fail` fixture. **NITS (4):** duplicate /api/version fetch on mount (dead `version` field in DashboardData); Refresh-health button not disabled while in flight (double-click → 2 concurrent runs of the expensive endpoint); useDashboardHealthQuery missing the `active` unmount-guard idiom the other hooks use; ~13 lines of dead `.ctv-activity-*`/`.ctv-release-*` CSS. **Verified good:** all six endpoint usages match the generated schemas exactly (incl. nullable `nowPlaying` narrowing, `totalCount` paging semantics, `libraries[]` nesting); health polling discipline clean (mount + manual refresh only, no intervals, fetch-count test); progress math guards non-finite dates, `finish<=start`, clamping; type safety solid (all types from `components['schemas']`, no `any`); scope clean (4 web-only files, v1.d.ts untouched); design-system tokens/components used throughout; on-air join is exactly what #109 asked for. Fixes will be pushed to this branch and CI re-run before merge.
timothy added 1 commit 2026-07-04 21:15:12 +02:00
fix(web): dashboard review fixes — real health status contract, dedupe version fetch, refresh guard (#109)
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 4m3s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Successful in 4m53s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Has been skipped
e6197d63ff
- Match the backend's exact health status contract ('pass'|'fail'|'warn'|'info')
  instead of fictional strings; 'info' now renders as a neutral/idle presentation
  and is excluded from failing/warning counts in summarizeHealth.
- Drop the redundant /api/version fetch from getDashboardData/DashboardData;
  SidebarVersion's useDashboardVersionQuery remains the single source.
- Disable "Refresh health" (via Button's loading prop) while a health request
  is in flight to prevent concurrent double-click requests.
- Add the active-flag unmount guard to useDashboardHealthQuery for consistency
  with useDashboardQuery/useChannelsQuery.
- Remove dead .ctv-activity-*/.ctv-release-* CSS left over from the removed
  activity feed/release notes UI.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
timothy merged commit 4ffd777b49 into main 2026-07-04 21:20:38 +02:00
Sign in to join this conversation.