SPA playouts: unwired delete/reset endpoints, missing erase-items/history + scheduling-context, templates preview calendar (blocks #91 phase b) #210

Closed
opened 2026-07-09 21:40:27 +02:00 by timothy · 2 comments
Owner

From the #203 mutation-depth sweep (2026-07-09). PARITY-OK: playout creation dialog (all 5 kinds), alternate-schedules editor (full), templates editor rows. Gaps:

Endpoint exists, SPA never calls it (cheap fixes):

  • Delete playout — DELETE /api/playouts/{id} exists (PlayoutController.cs:524); no delete UI or client wiring anywhere (grep deletePlayout → nothing). Blazor Playouts.razor:210–215.
  • Per-playout Reset/Refresh — POST /api/channels/{channelNumber}/playout/reset exists with exact Blazor semantics (ChannelController.cs:185); the SPA button is hard-disabled with a stale, factually wrong note "the API has no per-playout reset endpoint yet" (App.tsx:3279–3283). Related: the dedicated "Schedule Reset" control is also disabled (daily rebuild time is editable via Edit details, so capability partially preserved).

No endpoint + no UI:

  • Erase Items (Block) and Erase Items and History (Classic/Block/Sequential/Scripted) — e.g. ClassicPlayoutEditor.razor:40–42, BlockPlayoutEditor.razor:72–80. Needs new endpoints.
  • Per-item Scheduling Context / Troubleshoot dialog (Playouts.razor:259, ProcessSchedulingContext).

Preview/UX:

  • Templates "Preview Calendar" (PlayoutTemplatesEditor.razor:23,261–268,472–510, MudCalendar showing which template applies per date) — no SPA equivalent; NOT covered by the existing table-vs-calendar decision entry (that covers /app/templates). Build a lightweight month-grid or record a decision entry.
  • Minor: Classic "alternate schedules" button not disabled for OnDemand channels (Blazor ClassicPlayoutEditor.razor:21–32).

Severity: MUST-FIX for delete/reset wiring + erase endpoints (capabilities otherwise lost outright); preview calendar + minors are decision-or-fix. Refs: #91, #203.

From the #203 mutation-depth sweep (2026-07-09). PARITY-OK: playout creation dialog (all 5 kinds), alternate-schedules editor (full), templates editor rows. Gaps: **Endpoint exists, SPA never calls it (cheap fixes):** - **Delete playout** — `DELETE /api/playouts/{id}` exists (`PlayoutController.cs:524`); no delete UI or client wiring anywhere (`grep deletePlayout` → nothing). Blazor `Playouts.razor:210–215`. - **Per-playout Reset/Refresh** — `POST /api/channels/{channelNumber}/playout/reset` exists with exact Blazor semantics (`ChannelController.cs:185`); the SPA button is hard-disabled with a **stale, factually wrong** note "the API has no per-playout reset endpoint yet" (`App.tsx:3279–3283`). Related: the dedicated "Schedule Reset" control is also disabled (daily rebuild time is editable via Edit details, so capability partially preserved). **No endpoint + no UI:** - **Erase Items** (Block) and **Erase Items and History** (Classic/Block/Sequential/Scripted) — e.g. `ClassicPlayoutEditor.razor:40–42`, `BlockPlayoutEditor.razor:72–80`. Needs new endpoints. - **Per-item Scheduling Context / Troubleshoot dialog** (`Playouts.razor:259`, `ProcessSchedulingContext`). **Preview/UX:** - **Templates "Preview Calendar"** (`PlayoutTemplatesEditor.razor:23,261–268,472–510`, MudCalendar showing which template applies per date) — no SPA equivalent; NOT covered by the existing table-vs-calendar decision entry (that covers `/app/templates`). Build a lightweight month-grid or record a decision entry. - Minor: Classic "alternate schedules" button not disabled for OnDemand channels (Blazor `ClassicPlayoutEditor.razor:21–32`). **Severity: MUST-FIX for delete/reset wiring + erase endpoints** (capabilities otherwise lost outright); preview calendar + minors are decision-or-fix. Refs: #91, #203.
Author
Owner

Implementation up as PR #214. Approach notes vs the issue body:

  • Delete + Reset wired to the existing endpoints; Reset sends no mode so the server default (Classic→Refresh, else Reset) preserves exact Blazor semantics. The stale App.tsx comment/block is gone. The dedicated "Schedule reset" button was dropped rather than wired — daily rebuild time is already editable via Edit details; recorded as a decisions.md entry.
  • Erase: two new endpoints (POST /api/playouts/{id}/erase-items, .../erase-items-and-history) reusing the Blazor-side MediatR commands, with controller-side 404 pre-check + per-kind 422 guards mirroring the handler kind filters. SPA buttons per kind match Blazor (Block gets both variants).
  • Scheduling context: built, not deferred — GET /api/playouts/items/{id}/scheduling-context follows the decode-by-row-id decision; PlayoutItemResponseModel gained id (null for gap rows) + hasSchedulingContext; SPA shows the decoded JSON in a dialog.
  • Preview calendar: built — client-side month grid in the templates editor, TS port of AlternateScheduleSelector.GetScheduleForDate (same as Blazor's client-side computation), unit-tested.
  • Minor: alternate-schedules button now disabled for OnDemand channels (playoutMode added to the playouts list DTO).

Live-E2E verified reset/erase/delete against a real local instance. Closing on merge.

Implementation up as PR #214. Approach notes vs the issue body: - Delete + Reset wired to the existing endpoints; Reset sends no `mode` so the server default (Classic→Refresh, else Reset) preserves exact Blazor semantics. The stale App.tsx comment/block is gone. The dedicated "Schedule reset" button was **dropped** rather than wired — daily rebuild time is already editable via Edit details; recorded as a decisions.md entry. - Erase: two new endpoints (`POST /api/playouts/{id}/erase-items`, `.../erase-items-and-history`) reusing the Blazor-side MediatR commands, with controller-side 404 pre-check + per-kind 422 guards mirroring the handler kind filters. SPA buttons per kind match Blazor (Block gets both variants). - Scheduling context: **built**, not deferred — `GET /api/playouts/items/{id}/scheduling-context` follows the decode-by-row-id decision; `PlayoutItemResponseModel` gained `id` (null for gap rows) + `hasSchedulingContext`; SPA shows the decoded JSON in a dialog. - Preview calendar: **built** — client-side month grid in the templates editor, TS port of `AlternateScheduleSelector.GetScheduleForDate` (same as Blazor's client-side computation), unit-tested. - Minor: alternate-schedules button now disabled for OnDemand channels (`playoutMode` added to the playouts list DTO). Live-E2E verified reset/erase/delete against a real local instance. Closing on merge.
Author
Owner

Closed via PR #214 (merged to main, CI green incl. :latest image push).

What was done

  • Wired existing DELETE /api/playouts/{id} + POST /api/channels/{n}/playout/reset into the SPA (Delete with confirm; Reset with server-default build mode = Blazor semantics; stale App.tsx comment/block removed).
  • New endpoints POST /api/playouts/{id}/erase-items (Block/Sequential/Scripted) and .../erase-items-and-history (+Classic), reusing the Blazor-side ErasePlayoutItems/ErasePlayoutHistory commands; 404 pre-check + per-kind 422 guards mirroring the handler filters. SPA buttons per kind match Blazor exactly.
  • Scheduling context: GET /api/playouts/items/{id}/scheduling-context (decode-by-row-id decision); PlayoutItemResponseModel gained id (null for gap rows) + hasSchedulingContext; SPA per-item dialog renders the decoded JSON.
  • Templates Preview Calendar: client-side month grid (web/src/screens/playoutTemplateCalendar.ts), faithful TS port of AlternateScheduleSelector.GetScheduleForDate (year-wrap, inclusive bounds, day-overflow rules; reviewer diffed line-by-line), unit-tested.
  • Minor: alternate-schedules disabled for OnDemand channels (playoutMode added to the list DTO). Dedicated "Schedule reset" button deliberately dropped (rebuild time editable via Edit details) — decisions.md entry.

Files: PlayoutController.cs, ChannelController.cs (untouched, reused), new query+handler in ErsatzTV.Application/Playouts/Queries/, PlayoutItem*/PlayoutList*ResponseModel, web/src/api/playouts.ts, App.tsx PlayoutsScreen, PlayoutScheduleEditors.tsx + calendar helper, tests throughout, OpenAPI artifacts regenerated.

Verified: 967 ErsatzTV.Tests + 493 Core.Tests + 428 web tests green; live E2E (delete/reset/erase against a real instance, calendar rendered).

Deferred / follow-ups: #215 (EntityLocker lock-gating for API playout mutations — systemic posture, from the adversarial review).

Docs updated: blazor-route-parity.md (playout cluster → PARITY-OK), decisions.md (+schedule-reset entry), endpoint-index.md/v1.json/v1.d.ts regenerated.

**Closed via PR #214** (merged to main, CI green incl. `:latest` image push). **What was done** - Wired existing `DELETE /api/playouts/{id}` + `POST /api/channels/{n}/playout/reset` into the SPA (Delete with confirm; Reset with server-default build mode = Blazor semantics; stale App.tsx comment/block removed). - New endpoints `POST /api/playouts/{id}/erase-items` (Block/Sequential/Scripted) and `.../erase-items-and-history` (+Classic), reusing the Blazor-side `ErasePlayoutItems`/`ErasePlayoutHistory` commands; 404 pre-check + per-kind 422 guards mirroring the handler filters. SPA buttons per kind match Blazor exactly. - Scheduling context: `GET /api/playouts/items/{id}/scheduling-context` (decode-by-row-id decision); `PlayoutItemResponseModel` gained `id` (null for gap rows) + `hasSchedulingContext`; SPA per-item dialog renders the decoded JSON. - Templates Preview Calendar: client-side month grid (`web/src/screens/playoutTemplateCalendar.ts`), faithful TS port of `AlternateScheduleSelector.GetScheduleForDate` (year-wrap, inclusive bounds, day-overflow rules; reviewer diffed line-by-line), unit-tested. - Minor: alternate-schedules disabled for OnDemand channels (`playoutMode` added to the list DTO). Dedicated "Schedule reset" button deliberately dropped (rebuild time editable via Edit details) — decisions.md entry. **Files**: `PlayoutController.cs`, `ChannelController.cs` (untouched, reused), new query+handler in `ErsatzTV.Application/Playouts/Queries/`, `PlayoutItem*/PlayoutList*ResponseModel`, `web/src/api/playouts.ts`, `App.tsx` PlayoutsScreen, `PlayoutScheduleEditors.tsx` + calendar helper, tests throughout, OpenAPI artifacts regenerated. **Verified**: 967 ErsatzTV.Tests + 493 Core.Tests + 428 web tests green; live E2E (delete/reset/erase against a real instance, calendar rendered). **Deferred / follow-ups**: #215 (EntityLocker lock-gating for API playout mutations — systemic posture, from the adversarial review). **Docs updated**: `blazor-route-parity.md` (playout cluster → PARITY-OK), `decisions.md` (+schedule-reset entry), `endpoint-index.md`/`v1.json`/`v1.d.ts` regenerated.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: timothy/ersatztv#210