GRI-2202: picker Add N pages makes one document item with page overrides #316

Merged
vivy merged 3 commits from feature/GRI-2202-picker-single-document-item into dev 2026-11-17 23:17:15 +00:00
Member

Frontend half of #304. Companion backend PR: #312 (merge this one first — see below).

Why

After #312, PUT /playlists/{id}/items refuses kind: "document_page" with 422 document_page_not_allowed, and migration 0014 converts existing page items into one document item with page_overrides. The web UI still built and sent document_page items for "Add N pages".

Change

  • AddFromLibraryDialog.tsx / libraryPicker.ts: "Add N pages" (selection or range, e.g. 1-5,8-9) now hands back one { mediaId, pageOverrides } addition instead of one addition per page. Unselected pages become page_overrides[page] = { skip: true }. "Add whole document" and single-file adds are unchanged in shape.
  • PlaylistMediaTab.tsx: addItems builds one document playlist item carrying pageOverrides from each addition; libraryLabel now reads "(n of N pages)" when some are skipped, "(all pages)" otherwise.
  • httpPlaylistsApi.ts: dropped the document_page wire-item branch in replacePlaylistItems — the web UI never sends kind: "document_page" anymore.
  • Updated AddFromLibraryDialog.test.tsx / httpPlaylistsApi.test.ts for the new shape, and fixed a stale assertion in PlaylistsScreen.test.tsx that still expected one playlist item per selected page.

Read side (playlist items with page_overrides after 0014) was already handled by #278.

Test plan

  • ./scripts/local-gates.sh --frontend-only passes: prettier, oxlint, tsc, vitest (198/198), vite build.
  • Manually traced: selecting pages 1-2 of a 2-page document now yields one document item labelled "(all pages)"; selecting a subset yields one item labelled "(n of N pages)" with page_overrides skipping the rest.

Merge order: this PR, then #312 (per the forge issue, since #312 makes the server refuse document_page items).

Frontend half of #304. Companion backend PR: #312 (merge this one first — see below). ## Why After #312, `PUT /playlists/{id}/items` refuses `kind: "document_page"` with 422 `document_page_not_allowed`, and migration 0014 converts existing page items into one `document` item with `page_overrides`. The web UI still built and sent `document_page` items for "Add N pages". ## Change - `AddFromLibraryDialog.tsx` / `libraryPicker.ts`: "Add N pages" (selection or range, e.g. `1-5,8-9`) now hands back one `{ mediaId, pageOverrides }` addition instead of one addition per page. Unselected pages become `page_overrides[page] = { skip: true }`. "Add whole document" and single-file adds are unchanged in shape. - `PlaylistMediaTab.tsx`: `addItems` builds one `document` playlist item carrying `pageOverrides` from each addition; `libraryLabel` now reads "(n of N pages)" when some are skipped, "(all pages)" otherwise. - `httpPlaylistsApi.ts`: dropped the `document_page` wire-item branch in `replacePlaylistItems` — the web UI never sends `kind: "document_page"` anymore. - Updated `AddFromLibraryDialog.test.tsx` / `httpPlaylistsApi.test.ts` for the new shape, and fixed a stale assertion in `PlaylistsScreen.test.tsx` that still expected one playlist item per selected page. Read side (playlist items with `page_overrides` after 0014) was already handled by #278. ## Test plan - [x] `./scripts/local-gates.sh --frontend-only` passes: prettier, oxlint, tsc, vitest (198/198), vite build. - [x] Manually traced: selecting pages `1-2` of a 2-page document now yields one `document` item labelled "(all pages)"; selecting a subset yields one item labelled "(n of N pages)" with `page_overrides` skipping the rest. **Merge order:** this PR, then #312 (per the forge issue, since #312 makes the server refuse `document_page` items).
GRI-2202: fix formatting and update stale per-page-item test expectation
Some checks failed
CI / the pre-push hook (pull_request) Successful in 6s
CI / cargo fmt (pull_request) Successful in 5s
CI / install.sh client upgrade (pull_request) Successful in 12s
CI / cargo clippy (pull_request) Successful in 2m8s
CI / cargo deny advisories (pull_request) Successful in 1m10s
CI / cargo deny (pull_request) Successful in 1m8s
CI / repository boundary (pull_request) Successful in 6s
CI / frontend-web (pull_request) Failing after 1m19s
CI / cargo test (pull_request) Successful in 6m47s
CI / CI (pull_request) Failing after 1s
CI / Notify gate failed (pull_request) Successful in 1s
82503182c5
Merge branch 'dev' into feature/GRI-2202-picker-single-document-item
Some checks failed
CI / the pre-push hook (pull_request) Successful in 2s
CI / install.sh client upgrade (pull_request) Successful in 18s
CI / cargo fmt (pull_request) Successful in 6s
CI / cargo deny (pull_request) Successful in 20s
CI / cargo deny advisories (pull_request) Successful in 19s
CI / cargo clippy (pull_request) Successful in 1m27s
CI / repository boundary (pull_request) Successful in 4s
CI / frontend-web (pull_request) Successful in 1m4s
CI / cargo test (pull_request) Successful in 4m11s
CI / CI (pull_request) Successful in 1s
CI / Notify gate failed (pull_request) Failing after 12m30s
5290ac08cf
Owner

22:5x UTC: the one red test (AddMediaScreen.test.tsx › page progress "page N of 3 rendered") is in a file this PR does not touch, so I read it as a timing flake, not your change. Branch was 4 behind dev; I updated it (head 5290ac08) and CI runs again. If the same test fails again, please look at its waitFor timeout. Merge order stays: #316, then #312, then #317.

22:5x UTC: the one red test (`AddMediaScreen.test.tsx` › page progress "page N of 3 rendered") is in a file this PR does not touch, so I read it as a timing flake, not your change. Branch was 4 behind `dev`; I updated it (head `5290ac08`) and CI runs again. If the same test fails again, please look at its `waitFor` timeout. Merge order stays: #316, then #312, then #317.
vivy merged commit 13517fef1e into dev 2026-11-17 23:17:15 +00:00
vivy deleted branch feature/GRI-2202-picker-single-document-item 2026-11-17 23:17:16 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Grimoirix/grimoire-of-digital-signage!316
No description provided.