ChicoryTV SPA: Channels screen #84

Closed
opened 2026-07-02 01:07:18 +02:00 by timothy · 7 comments
Owner

Recreate design-system/templates/chicorytv-admin/Channels.jsx wired to the Channel API.

Dense table, bulk-select, (D)/(H) markers, streaming-mode badges, inline actions. Acceptance: matches prototype; live data + working actions; all 3 themes.

Recreate `design-system/templates/chicorytv-admin/Channels.jsx` wired to the Channel API. Dense table, bulk-select, `(D)`/`(H)` markers, streaming-mode badges, inline actions. **Acceptance:** matches prototype; live data + working actions; all 3 themes.
timothy added the frontend label 2026-07-02 01:07:18 +02:00
timothy added a new dependency 2026-07-02 01:08:41 +02:00
timothy added a new dependency 2026-07-02 01:08:42 +02:00
Author
Owner

API-gap audit — backend prerequisites created

The Channels management table needs read/write API support the redesign backend epic (#62) never covered — #62 was scoped to the Channel Builder/create flow only. New backend issues:

  • #96 — extend the list DTO with group/isEnabled/showInEpg (+sortNumber). Blocks this issue — required for grouping, (D)/(H) markers, disabled-dimming. Tiny (DTO+mapper, no migration).
  • #98 — bulk operations (renumber / move-to-group / bulk delete). Blocks this issue — required for the selection action bar.
  • #97 — on-air / now-playing state. Related, not blocking — implement the On-air filter + live lane + Now-playing column against it, but degrade to Idle/Off-air until it lands.

Sequencing: do the backend issues first (at least #96); do not expand the API inside this SPA issue — that would put C# API changes in a frontend issue and break the layering / "UI drives API" discipline. #96 is trivial and can land immediately so this issue isn't blocked long. Ship this screen in phases: core table (needs #96) → bulk actions (#98) → live treatment (#97).

### API-gap audit — backend prerequisites created The Channels management table needs read/write API support the redesign backend epic (#62) never covered — #62 was scoped to the Channel Builder/create flow only. New backend issues: - **#96** — extend the list DTO with `group`/`isEnabled`/`showInEpg` (+sortNumber). **Blocks this issue** — required for grouping, (D)/(H) markers, disabled-dimming. Tiny (DTO+mapper, no migration). - **#98** — bulk operations (renumber / move-to-group / bulk delete). **Blocks this issue** — required for the selection action bar. - **#97** — on-air / now-playing state. **Related, not blocking** — implement the On-air filter + live lane + Now-playing column against it, but degrade to Idle/Off-air until it lands. **Sequencing:** do the backend issues **first** (at least #96); do **not** expand the API inside this SPA issue — that would put C# API changes in a frontend issue and break the layering / "UI drives API" discipline. #96 is trivial and can land immediately so this issue isn't blocked long. Ship this screen in phases: core table (needs #96) → bulk actions (#98) → live treatment (#97).
Author
Owner

Implementation approach before coding

I read #84, the #59 Definition of Ready, Channels.jsx, generated web/src/api/generated/v1.d.ts, and the existing Dashboard data-layer pattern from PR #123.

Prototype surface API / DTO mapping Scope decision
Dense channel table rows GET /api/channels -> ChannelResponseModel[] In scope. Sort by sortNumber, group by group, render number/name/language/streaming/FFmpeg.
Group headers/counts ChannelResponseModel.group In scope. Preserve sorted row order while grouping.
(D) disabled marker and disabled dimming ChannelResponseModel.isEnabled In scope.
(H) hidden-from-EPG marker ChannelResponseModel.showInEpg In scope.
On-air filter/live rail/live dot GET /api/channels/state -> ChannelStateResponseModel.onAir In scope. Render current backend state as-is; no /api/health polling here.
Now-playing lane/progress ChannelStateResponseModel.nowPlaying nullable, ChannelNowPlayingResponseModel.title/startUtc/finishUtc In scope. Null now-playing renders Idle/Off air without fabricated text.
Streaming badge ChannelResponseModel.streamingMode string from backend mapper (MPEG-TS (Legacy), MPEG-TS, HLS Direct, HLS Segmenter) In scope; branch values copied from ErsatzTV.Application/Channels/Mapper.cs.
Bulk select/action bar Local selected channel IDs + bulk endpoints In scope. Refetch after mutation rather than optimistic updates.
Bulk renumber POST /api/channels/bulk/renumber -> BulkRenumberChannelsRequest.channels[] In scope as a compact renumber of the current selected rows in visible/sorted order, preserving existing number style as much as possible.
Bulk move group POST /api/channels/bulk/group -> BulkMoveChannelsToGroupRequest In scope with a lightweight group prompt using existing group names/free text.
Bulk delete POST /api/channels/bulk/delete -> BulkDeleteChannelsRequest In scope with confirmation and ProblemDetails error display.
Row delete DELETE /api/channels/{id} In scope with confirmation and refetch.
Preview Existing IPTV playback URLs, no new backend In scope as an external/open action when enough row data exists; disabled if the row is not on air.
Edit/Add full flow Channel CRUD exists, but full Channel Builder is #89 Out of scope for this issue. I will keep the affordance but route/disable it as a builder placeholder instead of building forms here.
Troubleshoot Existing backend areas are not part of this screen contract Out of scope unless an existing SPA route is present; keep as a non-mutating placeholder/disabled affordance rather than adding endpoints.

Data layer plan: expand web/src/api/channels.ts with typed channel/state queries, bulk/delete helpers, and a useChannelsScreenQuery hook that follows the Dashboard active unmount guard. Channel state polling, if used, will be gentle at 30s or slower and scoped to this hook. UI plan: replace the Channels placeholder route in App.tsx with the design-system table using existing primitives (Button, IconButton, Checkbox, Badge, StatusDot, ChannelLogo, ProgressBar, Spinner), plus loading/error/empty states and tests for data rendering, nullable now-playing, bulk errors, and refetch-after-mutate.

### Implementation approach before coding I read #84, the #59 Definition of Ready, `Channels.jsx`, generated `web/src/api/generated/v1.d.ts`, and the existing Dashboard data-layer pattern from PR #123. | Prototype surface | API / DTO mapping | Scope decision | | --- | --- | --- | | Dense channel table rows | `GET /api/channels` -> `ChannelResponseModel[]` | In scope. Sort by `sortNumber`, group by `group`, render number/name/language/streaming/FFmpeg. | | Group headers/counts | `ChannelResponseModel.group` | In scope. Preserve sorted row order while grouping. | | `(D)` disabled marker and disabled dimming | `ChannelResponseModel.isEnabled` | In scope. | | `(H)` hidden-from-EPG marker | `ChannelResponseModel.showInEpg` | In scope. | | On-air filter/live rail/live dot | `GET /api/channels/state` -> `ChannelStateResponseModel.onAir` | In scope. Render current backend state as-is; no `/api/health` polling here. | | Now-playing lane/progress | `ChannelStateResponseModel.nowPlaying` nullable, `ChannelNowPlayingResponseModel.title/startUtc/finishUtc` | In scope. Null now-playing renders Idle/Off air without fabricated text. | | Streaming badge | `ChannelResponseModel.streamingMode` string from backend mapper (`MPEG-TS (Legacy)`, `MPEG-TS`, `HLS Direct`, `HLS Segmenter`) | In scope; branch values copied from `ErsatzTV.Application/Channels/Mapper.cs`. | | Bulk select/action bar | Local selected channel IDs + bulk endpoints | In scope. Refetch after mutation rather than optimistic updates. | | Bulk renumber | `POST /api/channels/bulk/renumber` -> `BulkRenumberChannelsRequest.channels[]` | In scope as a compact renumber of the current selected rows in visible/sorted order, preserving existing number style as much as possible. | | Bulk move group | `POST /api/channels/bulk/group` -> `BulkMoveChannelsToGroupRequest` | In scope with a lightweight group prompt using existing group names/free text. | | Bulk delete | `POST /api/channels/bulk/delete` -> `BulkDeleteChannelsRequest` | In scope with confirmation and ProblemDetails error display. | | Row delete | `DELETE /api/channels/{id}` | In scope with confirmation and refetch. | | Preview | Existing IPTV playback URLs, no new backend | In scope as an external/open action when enough row data exists; disabled if the row is not on air. | | Edit/Add full flow | Channel CRUD exists, but full Channel Builder is #89 | Out of scope for this issue. I will keep the affordance but route/disable it as a builder placeholder instead of building forms here. | | Troubleshoot | Existing backend areas are not part of this screen contract | Out of scope unless an existing SPA route is present; keep as a non-mutating placeholder/disabled affordance rather than adding endpoints. | Data layer plan: expand `web/src/api/channels.ts` with typed channel/state queries, bulk/delete helpers, and a `useChannelsScreenQuery` hook that follows the Dashboard `active` unmount guard. Channel state polling, if used, will be gentle at 30s or slower and scoped to this hook. UI plan: replace the Channels placeholder route in `App.tsx` with the design-system table using existing primitives (`Button`, `IconButton`, `Checkbox`, `Badge`, `StatusDot`, `ChannelLogo`, `ProgressBar`, `Spinner`), plus loading/error/empty states and tests for data rendering, nullable now-playing, bulk errors, and refetch-after-mutate.
Author
Owner

Review

Read-only review of the uncommitted feat/84-channels-screen worktree diff; no code changes made.

Findings:

  1. web/src/App.tsx:1105-1148 — Preview is exposed for any onAir row, but the existing Channels behavior requires stronger gating and URL shaping. The current button opens /iptv/channel/{number}.m3u8 directly and ignores the existing preview constraints from ErsatzTV/Pages/Channels.razor (CanPreviewChannel, FFmpeg/browser capability checks, ?mode=segmenter, JWT access token propagation). That means "working actions" is not met for HLS Direct / MPEG-TS (Legacy) / unsupported profile cases, and preview will also break when JWT-protected IPTV URLs are in play.

  2. web/src/api/channels.ts:34-40,104-123 — The polling hook refreshes both /api/channels and /api/channels/state every 30s. The requirement here was channel-state polling; the static channel list does not need that cadence. This doubles background traffic and makes transient /api/channels failures tear down the whole screen during a poll even when only live state should be updating.

Residual risk / test gap:

  • web/src/App.test.tsx covers render/filter/delete/bulk-error flows, but there is still no test around preview enablement/URL construction or the polling contract (30s cadence + cleanup on unmount).
## Review Read-only review of the uncommitted `feat/84-channels-screen` worktree diff; no code changes made. Findings: 1. `web/src/App.tsx:1105-1148` — Preview is exposed for any `onAir` row, but the existing Channels behavior requires stronger gating and URL shaping. The current button opens `/iptv/channel/{number}.m3u8` directly and ignores the existing preview constraints from `ErsatzTV/Pages/Channels.razor` (`CanPreviewChannel`, FFmpeg/browser capability checks, `?mode=segmenter`, JWT access token propagation). That means "working actions" is not met for HLS Direct / MPEG-TS (Legacy) / unsupported profile cases, and preview will also break when JWT-protected IPTV URLs are in play. 2. `web/src/api/channels.ts:34-40,104-123` — The polling hook refreshes both `/api/channels` and `/api/channels/state` every 30s. The requirement here was channel-state polling; the static channel list does not need that cadence. This doubles background traffic and makes transient `/api/channels` failures tear down the whole screen during a poll even when only live state should be updating. Residual risk / test gap: - `web/src/App.test.tsx` covers render/filter/delete/bulk-error flows, but there is still no test around preview enablement/URL construction or the polling contract (30s cadence + cleanup on unmount).
Author
Owner

Progress

Opened PR #124: #124

Implemented the Channels screen as frontend-only work on feat/84-channels-screen (15c6cdd0868265ccbe6aa46afce698863e95494f).

Key scope decisions:

  • Data-backed table, grouping, (D)/(H) markers, live state, now-playing, filters, row delete, and bulk renumber/group/delete are in scope.
  • Channel-state polling refreshes only /api/channels/state at 30s.
  • Preview is intentionally disabled because the list DTO does not include the legacy preview gating/JWT/profile support needed to make it a working action without inventing behavior.
  • Add/Edit full forms remain #89; Troubleshoot remains out of scope.

Verification completed locally:

  • cd web && npm ci && npm run lint && npm run typecheck && npm test -- --run && npm run build (37 web tests)
  • TZ=UTC dotnet build ErsatzTV.sln
  • TZ=UTC dotnet test ErsatzTV.Tests/ErsatzTV.Tests.csproj --no-build -v normal (368/368)
  • TZ=UTC dotnet test ErsatzTV.Core.Tests/ErsatzTV.Core.Tests.csproj --no-build -v normal (493 passed, 1 skipped)

Next: poll PR CI to green, then stop for Fable/Claude read-only review before any merge.

## Progress Opened PR #124: https://gitea.tblindustries.be/timothy/ersatztv/pulls/124 Implemented the Channels screen as frontend-only work on `feat/84-channels-screen` (`15c6cdd0868265ccbe6aa46afce698863e95494f`). Key scope decisions: - Data-backed table, grouping, `(D)`/`(H)` markers, live state, now-playing, filters, row delete, and bulk renumber/group/delete are in scope. - Channel-state polling refreshes only `/api/channels/state` at 30s. - Preview is intentionally disabled because the list DTO does not include the legacy preview gating/JWT/profile support needed to make it a working action without inventing behavior. - Add/Edit full forms remain #89; Troubleshoot remains out of scope. Verification completed locally: - `cd web && npm ci && npm run lint && npm run typecheck && npm test -- --run && npm run build` (37 web tests) - `TZ=UTC dotnet build ErsatzTV.sln` - `TZ=UTC dotnet test ErsatzTV.Tests/ErsatzTV.Tests.csproj --no-build -v normal` (368/368) - `TZ=UTC dotnet test ErsatzTV.Core.Tests/ErsatzTV.Core.Tests.csproj --no-build -v normal` (493 passed, 1 skipped) Next: poll PR CI to green, then stop for Fable/Claude read-only review before any merge.
Author
Owner

Done

What was done: Implemented the frontend Channels screen on feat/84-channels-screen and opened PR #124: #124. The screen wires the channel list/state endpoints into a dense grouped table with selection, live state, now-playing, markers, filters, row delete, and bulk renumber/group/delete flows.

Root cause: n/a (feature work).

Files changed: web/src/api/channels.ts, web/src/App.tsx, web/src/App.test.tsx, web/src/shell.css.

Verification: Local web sequence passed (npm ci, lint, typecheck, 37 tests, build). Local backend verification passed: TZ=UTC dotnet build ErsatzTV.sln, ErsatzTV.Tests 368/368, ErsatzTV.Core.Tests 493 passed / 1 skipped. PR CI is green for head 15c6cdd0868265ccbe6aa46afce698863e95494f: Build & test succeeded, EF migration integrity succeeded, pull-request image publish job skipped by workflow conditions.

Deferred: Preview remains disabled because the list DTO does not expose the existing legacy preview gating/JWT/profile requirements needed for a working preview action without inventing behavior. Add/Edit full Channel Builder remains #89. Troubleshoot remains out of scope.

Follow-up issues: #89 for Channel Builder; any future preview enablement should first expose or reuse the same backend-supported preview contract as the existing Razor page.

Docs updated: n/a.

Leaving #84 open because this work is pending Fable/Claude read-only review and merge consent; PR body uses Closes #84 for merge-time closure.

## Done **What was done**: Implemented the frontend Channels screen on `feat/84-channels-screen` and opened PR #124: https://gitea.tblindustries.be/timothy/ersatztv/pulls/124. The screen wires the channel list/state endpoints into a dense grouped table with selection, live state, now-playing, markers, filters, row delete, and bulk renumber/group/delete flows. **Root cause**: n/a (feature work). **Files changed**: `web/src/api/channels.ts`, `web/src/App.tsx`, `web/src/App.test.tsx`, `web/src/shell.css`. **Verification**: Local web sequence passed (`npm ci`, lint, typecheck, 37 tests, build). Local backend verification passed: `TZ=UTC dotnet build ErsatzTV.sln`, `ErsatzTV.Tests` 368/368, `ErsatzTV.Core.Tests` 493 passed / 1 skipped. PR CI is green for head `15c6cdd0868265ccbe6aa46afce698863e95494f`: Build & test succeeded, EF migration integrity succeeded, pull-request image publish job skipped by workflow conditions. **Deferred**: Preview remains disabled because the list DTO does not expose the existing legacy preview gating/JWT/profile requirements needed for a working preview action without inventing behavior. Add/Edit full Channel Builder remains #89. Troubleshoot remains out of scope. **Follow-up issues**: #89 for Channel Builder; any future preview enablement should first expose or reuse the same backend-supported preview contract as the existing Razor page. **Docs updated**: n/a. Leaving #84 open because this work is pending Fable/Claude read-only review and merge consent; PR body uses `Closes #84` for merge-time closure.
Author
Owner

Fable review of PR #124 complete (3-lens subagent review — correctness, contract/tests, design-system/scope): APPROVE with findings, no blockers. Full findings on the PR: #124 (comment)

Summary: all API contracts, fixtures, polling discipline, component prop usage, and scope boundaries verified clean. Two SUBSTANTIAL items before/right after merge: (1) bulk operations act on selected rows hidden by the active filter (destructive delete can hit unseen channels); (2) the bulk-renumber flow has zero test coverage. Six nits (stale-poll window, per-row delete not disabled while mutating, poll continues in error state, lax renumber input parsing, minor test gaps, minor CSS/prototype-fidelity items). Merge pending user consent.

Fable review of PR #124 complete (3-lens subagent review — correctness, contract/tests, design-system/scope): **APPROVE with findings, no blockers**. Full findings on the PR: https://gitea.tblindustries.be/timothy/ersatztv/pulls/124#issuecomment-6285 Summary: all API contracts, fixtures, polling discipline, component prop usage, and scope boundaries verified clean. Two SUBSTANTIAL items before/right after merge: (1) bulk operations act on selected rows hidden by the active filter (destructive delete can hit unseen channels); (2) the bulk-renumber flow has zero test coverage. Six nits (stale-poll window, per-row delete not disabled while mutating, poll continues in error state, lax renumber input parsing, minor test gaps, minor CSS/prototype-fidelity items). Merge pending user consent.
Author
Owner

Closing — #84 Channels screen shipped

What was done: ChicoryTV SPA Channels screen (PR #124, Codex) — dense grouped channel table wired to the live API (GET /api/channels + /api/channels/state), All/On air/Disabled segmented filter, (D)/(H) markers, now-playing with progress, streaming-mode badges, bulk renumber/move-group/delete + row delete with ProblemDetails error display, 30s background poll of channel state only. Fable review (3-lens subagent review) verdict: approve with findings, no blockers — all API contracts, fixtures, polling discipline, and scope boundaries verified clean.

Review fixes applied on the branch before merge (commit ecf6cf75, Fable via subagent): bulk ops scoped to visible rows + selection cleared on filter change (the reachable path was the 30s poll hiding a selected row under the on-air filter — the filter-buttons-while-selected path is structurally impossible since the bulk toolbar replaces them); per-row delete disabled while a mutation is in flight; corrected --pad-cell-x fallback; added tests for bulk renumber (request body + selection clearing) and filter-change selection reset. Final: 39/39 web tests, lint/typecheck/build green, PR CI green.

Merged: PR #124 → main 7ee6e987 (branch deleted). Post-merge main run being verified.

Deferred: Preview button disabled (list DTO lacks legacy preview gating/JWT/profile data — revisit with #89/#99); Add/Edit navigate to the #89 Channel Builder placeholder; Troubleshoot out of scope. Remaining review nits (stale-poll overwrite window ≤30s, poll continues in error state, lax renumber input parsing, minor test gaps, prototype hover-fidelity) recorded on PR #124 — acceptable as-is, roll into future Channels work.

Files changed: web/src/App.tsx, web/src/App.test.tsx, web/src/api/channels.ts, web/src/shell.css.

Docs: handoff docs/handoffs/chicorytv-issue-queue.md being updated with next prompt (#86 Schedule editor).

## Closing — #84 Channels screen shipped **What was done**: ChicoryTV SPA Channels screen (PR #124, Codex) — dense grouped channel table wired to the live API (GET /api/channels + /api/channels/state), All/On air/Disabled segmented filter, (D)/(H) markers, now-playing with progress, streaming-mode badges, bulk renumber/move-group/delete + row delete with ProblemDetails error display, 30s background poll of channel state only. Fable review (3-lens subagent review) verdict: approve with findings, no blockers — all API contracts, fixtures, polling discipline, and scope boundaries verified clean. **Review fixes applied on the branch before merge** (commit ecf6cf75, Fable via subagent): bulk ops scoped to visible rows + selection cleared on filter change (the reachable path was the 30s poll hiding a selected row under the on-air filter — the filter-buttons-while-selected path is structurally impossible since the bulk toolbar replaces them); per-row delete disabled while a mutation is in flight; corrected `--pad-cell-x` fallback; added tests for bulk renumber (request body + selection clearing) and filter-change selection reset. Final: 39/39 web tests, lint/typecheck/build green, PR CI green. **Merged**: PR #124 → main `7ee6e987` (branch deleted). Post-merge main run being verified. **Deferred**: Preview button disabled (list DTO lacks legacy preview gating/JWT/profile data — revisit with #89/#99); Add/Edit navigate to the #89 Channel Builder placeholder; Troubleshoot out of scope. Remaining review nits (stale-poll overwrite window ≤30s, poll continues in error state, lax renumber input parsing, minor test gaps, prototype hover-fidelity) recorded on PR #124 — acceptable as-is, roll into future Channels work. **Files changed**: web/src/App.tsx, web/src/App.test.tsx, web/src/api/channels.ts, web/src/shell.css. **Docs**: handoff docs/handoffs/chicorytv-issue-queue.md being updated with next prompt (#86 Schedule editor).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: timothy/ersatztv#84