GRI-1981: media library groups a PDF's pages under its document #176

Merged
vivy merged 1 commit from feature/GRI-1981-media-pdf-grouping into dev 2026-11-14 02:46:03 +00:00
Member

Closes #158.

What

After a PDF upload the media library listed every rendered page as its own top-level item. GET /media already returns the document row and its document_page rows with document_id/pdf_pages set (crates/server/src/media/handlers.rs); the client only carried a subset of those fields through. This groups on the client, per the comment on #158.

Changes

  • MediaItem carries documentId/pageCount; httpMediaApi.fromWire stops dropping them.
  • mockMediaApi now emits a document parent row plus document_page rows (matching the real wire shape) instead of only page rows, and a document delete cascades to its pages, same as the server's DELETE ... WHERE id = $1 OR document_id = $1.
  • MediaScreen: a document is one row with a page count and an expand control; its pages render nested under it when expanded and never appear at top level. Deleting the document removes its pages too.
  • PlaylistEditorScreen's add-from-library picker: the document is the selectable option (optgroup labelled with its name), its pages nested under it — never a page at top level.

Gap

"Thumbnails" in the acceptance text assumes a way to render a page's image. There is no file-serving endpoint for media today (crates/server/src/media/mod.rs has only upload/list/url/delete routes) and the panel has no <img> anywhere yet. Pages render as text (page number + size), consistent with the rest of the library. Flagged on the forge issue as follow-up backend+frontend work rather than inventing an endpoint here.

Test plan

  • npm --prefix frontend-web run check (prettier, oxlint, tsc, vitest) — 50/50 passing.
  • ./scripts/local-gates.sh --frontend-only — every gate passed.
  • New/updated tests: MediaScreen.test.tsx (grouping, expand/collapse, document-delete-cascades-to-pages), PlaylistsScreen.test.tsx (picker groups a document's pages under it via optgroup, no page listed at top level).
Closes #158. ## What After a PDF upload the media library listed every rendered page as its own top-level item. `GET /media` already returns the `document` row and its `document_page` rows with `document_id`/`pdf_pages` set (`crates/server/src/media/handlers.rs`); the client only carried a subset of those fields through. This groups on the client, per the comment on #158. ## Changes - `MediaItem` carries `documentId`/`pageCount`; `httpMediaApi.fromWire` stops dropping them. - `mockMediaApi` now emits a `document` parent row plus `document_page` rows (matching the real wire shape) instead of only page rows, and a document delete cascades to its pages, same as the server's `DELETE ... WHERE id = $1 OR document_id = $1`. - `MediaScreen`: a document is one row with a page count and an expand control; its pages render nested under it when expanded and never appear at top level. Deleting the document removes its pages too. - `PlaylistEditorScreen`'s add-from-library picker: the document is the selectable option (`optgroup` labelled with its name), its pages nested under it — never a page at top level. ## Gap "Thumbnails" in the acceptance text assumes a way to render a page's image. There is no file-serving endpoint for media today (`crates/server/src/media/mod.rs` has only upload/list/url/delete routes) and the panel has no `<img>` anywhere yet. Pages render as text (page number + size), consistent with the rest of the library. Flagged on the forge issue as follow-up backend+frontend work rather than inventing an endpoint here. ## Test plan - `npm --prefix frontend-web run check` (prettier, oxlint, tsc, vitest) — 50/50 passing. - `./scripts/local-gates.sh --frontend-only` — every gate passed. - New/updated tests: `MediaScreen.test.tsx` (grouping, expand/collapse, document-delete-cascades-to-pages), `PlaylistsScreen.test.tsx` (picker groups a document's pages under it via `optgroup`, no page listed at top level).
GRI-1981: media library groups a PDF's pages under its document
Some checks failed
CI / cargo fmt (pull_request) Successful in 1m2s
CI / the pre-push hook (pull_request) Successful in 1m2s
CI / cargo deny (pull_request) Successful in 1m32s
CI / cargo clippy (pull_request) Successful in 2m34s
CI / cargo deny advisories (pull_request) Failing after 1m31s
CI / repository boundary (pull_request) Successful in 34s
CI / cargo test (pull_request) Successful in 3m29s
CI / frontend-web (pull_request) Successful in 1m31s
CI / Notify gate failed (pull_request) Has been skipped
CI / CI (pull_request) Successful in 37s
b73fbfb27a
Media list now groups a document's `document_page` rows under the
document, with a page count and an expand control, instead of listing
every page as its own top-level item (field feedback on GRI-1960). The
playlist editor's add-from-library picker does the same: the document
is the selectable option, its pages nested under it in an optgroup.
vivy merged commit aa297c4ec1 into dev 2026-11-14 02:46:03 +00:00
vivy deleted branch feature/GRI-1981-media-pdf-grouping 2026-11-14 02:46:05 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
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!176
No description provided.