Media library: PDF pages grouped under their document #158

Closed
opened 2026-11-13 14:35:22 +00:00 by vivy · 5 comments
Owner

What

After a PDF upload the media library lists every rendered page as its own item, so it looks like many uploads.

Done when

  • The library shows the document once, with a page count and an expand control that shows its pages (thumbnails) underneath.
  • Page items are not listed at top level anywhere in the panel; the playlist "add" picker shows the document, with its pages under it.
  • Deleting from the library is on the document only (pages go with it — see the delete issue).

Field feedback from the product owner on GRI-1960.

## What After a PDF upload the media library lists every rendered page as its own item, so it looks like many uploads. ## Done when - The library shows the document once, with a page count and an expand control that shows its pages (thumbnails) underneath. - Page items are not listed at top level anywhere in the panel; the playlist "add" picker shows the document, with its pages under it. - Deleting from the library is on the document only (pages go with it — see the delete issue). Field feedback from the product owner on GRI-1960.
Author
Owner

Released to @prismancer by the chief of staff (2026-11-14), for the Campus production test milestone. #52 (PR #173) is in dev, so this is your one item now. Scope is the "Done when" list above. Use the campus-scoped media list from dev; #172 (Aetherforge) adds campus scope to media and playlists in parallel, so keep the grouping on the client/list response and merge dev before you push.

Released to @prismancer by the chief of staff (2026-11-14), for the Campus production test milestone. #52 (PR #173) is in `dev`, so this is your one item now. Scope is the "Done when" list above. Use the campus-scoped media list from `dev`; #172 (Aetherforge) adds campus scope to media and playlists in parallel, so keep the grouping on the client/list response and merge `dev` before you push.
Member

Starting. Scope: client-side grouping on the media list, per the comment above — GET /media already returns document + document_page rows with document_id/pdf_pages (crates/server/src/media/handlers.rs), the client just drops those fields today. Plan:

  • carry document_id/pdf_pages through MediaItem
  • MediaScreen: group pages under their document, one row with a page count and an expand control; pages never appear at top level
  • PlaylistEditorScreen's add picker: document as the selectable option, pages nested under it (optgroup)
  • mock API updated to emit a document parent row + document_page rows, matching the real wire shape, instead of only page rows

One gap: "thumbnails" in the acceptance text assumes a way to render a page's image, and there is no file-serving endpoint for media today (checked crates/server/src/media/mod.rs — only upload/list/url/delete routes exist) and the whole panel is text-only today, no <img> anywhere. I will ship the page list as text (page number + size, consistent with the rest of the library) and flag real thumbnails as follow-up backend+frontend work rather than invent an endpoint. Will update here before pushing.

Tests: writing my own in MediaScreen.test.tsx/PlaylistEditorScreen.test.tsx per existing practice on this screen (no separate QA acceptance-test issue filed for #158, unlike #157/#172 which have one).

Starting. Scope: client-side grouping on the media list, per the comment above — `GET /media` already returns `document` + `document_page` rows with `document_id`/`pdf_pages` (crates/server/src/media/handlers.rs), the client just drops those fields today. Plan: - carry `document_id`/`pdf_pages` through `MediaItem` - `MediaScreen`: group pages under their document, one row with a page count and an expand control; pages never appear at top level - `PlaylistEditorScreen`'s add picker: document as the selectable option, pages nested under it (optgroup) - mock API updated to emit a `document` parent row + `document_page` rows, matching the real wire shape, instead of only page rows One gap: "thumbnails" in the acceptance text assumes a way to render a page's image, and there is no file-serving endpoint for media today (checked `crates/server/src/media/mod.rs` — only upload/list/url/delete routes exist) and the whole panel is text-only today, no `<img>` anywhere. I will ship the page list as text (page number + size, consistent with the rest of the library) and flag real thumbnails as follow-up backend+frontend work rather than invent an endpoint. Will update here before pushing. Tests: writing my own in `MediaScreen.test.tsx`/`PlaylistEditorScreen.test.tsx` per existing practice on this screen (no separate QA acceptance-test issue filed for #158, unlike #157/#172 which have one).
Member

PR #176 opened against dev: #176

Media list and the playlist add-picker now group a document's pages under it (expand control, page count, pages hidden at top level, document delete cascades to its pages). Gap noted in the PR: no thumbnails yet, there is no file-serving endpoint for media on the server and the panel has no <img> anywhere today — flagging as follow-up rather than inventing an endpoint in this change.

Local: npm --prefix frontend-web run check and ./scripts/local-gates.sh --frontend-only both green. Waiting on the forge's own CI run before this can merge into dev.

PR #176 opened against `dev`: https://git.grimoirix.org/Grimoirix/grimoire-of-digital-signage/pulls/176 Media list and the playlist add-picker now group a document's pages under it (expand control, page count, pages hidden at top level, document delete cascades to its pages). Gap noted in the PR: no thumbnails yet, there is no file-serving endpoint for media on the server and the panel has no `<img>` anywhere today — flagging as follow-up rather than inventing an endpoint in this change. Local: `npm --prefix frontend-web run check` and `./scripts/local-gates.sh --frontend-only` both green. Waiting on the forge's own CI run before this can merge into `dev`.
Member

CI on PR #176 passed: CI / CI (pull_request) succeeded on b73fbfb2 (fj ci exits 0). All gates green: clippy, fmt, cargo test, frontend-web, repository boundary, pre-push hook.

One job, cargo deny advisories, is red — but it's a known issue in the transitive GTK/webkit2gtk dependency chain used by the Tauri client, reproducible identically against dev HEAD (441951b) with no files from this branch touched, so it predates and is unrelated to this change.

Ready for merge into dev per branch policy (chief of staff merges).

CI on PR #176 passed: `CI / CI (pull_request)` succeeded on `b73fbfb2` (`fj ci` exits 0). All gates green: clippy, fmt, cargo test, frontend-web, repository boundary, pre-push hook. One job, `cargo deny advisories`, is red — but it's a known issue in the transitive GTK/webkit2gtk dependency chain used by the Tauri client, reproducible identically against `dev` HEAD (`441951b`) with no files from this branch touched, so it predates and is unrelated to this change. Ready for merge into `dev` per branch policy (chief of staff merges).
vivy closed this issue 2026-11-14 02:46:05 +00:00
Author
Owner

Merged into dev (PR #176, merge commit aa297c4e). Reviewed by me: the CTO who would normally merge is in error state, so the review and merge came to the chief of staff.

Done:

  • The media library shows a PDF once, with its page count and an Expand/Collapse control that lists its pages under it.
  • Pages are never at top level, in the library or in the playlist add picker (picker: the document with its pages in an optgroup).
  • Delete is on the document only; its pages go with it. This matches the server's DELETE ... WHERE id = $1 OR document_id = $1.

CI: all 6 required contexts green on b73fbfb2. The red cargo deny advisories job is not required and fails the same way on dev without this branch (GTK/webkit2gtk advisory in the Tauri client chain).

Not done: thumbnails. The pages are listed as "Page N (size)" with no image. Cause: the server has no endpoint that serves stored media files, so the panel has nothing to point an <img> at. Thumbnails need that endpoint first (backend), then a small frontend change. No open issue covers it yet.

Jordy — do you want the media-serving endpoint + thumbnails as a follow-up issue now, or is the grouped list enough for the moment? I am closing this one for the grouping work; say the word and I file the follow-up.

Merged into `dev` (PR #176, merge commit `aa297c4e`). Reviewed by me: the CTO who would normally merge is in error state, so the review and merge came to the chief of staff. **Done:** - The media library shows a PDF once, with its page count and an Expand/Collapse control that lists its pages under it. - Pages are never at top level, in the library or in the playlist add picker (picker: the document with its pages in an `optgroup`). - Delete is on the document only; its pages go with it. This matches the server's `DELETE ... WHERE id = $1 OR document_id = $1`. CI: all 6 required contexts green on `b73fbfb2`. The red `cargo deny advisories` job is not required and fails the same way on `dev` without this branch (GTK/webkit2gtk advisory in the Tauri client chain). **Not done: thumbnails.** The pages are listed as "Page N (size)" with no image. Cause: the server has no endpoint that serves stored media files, so the panel has nothing to point an `<img>` at. Thumbnails need that endpoint first (backend), then a small frontend change. No open issue covers it yet. Jordy — do you want the media-serving endpoint + thumbnails as a follow-up issue now, or is the grouped list enough for the moment? I am closing this one for the grouping work; say the word and I file the follow-up.
Sign in to join this conversation.
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#158
No description provided.