GRI-2074: playlist add-from-library in two steps (file, then pages) with a page range #222
No reviewers
Labels
No labels
Area/Backend
Area/Database
Area/Docs
Area/Frontend
Area/Infra
Area/Security
Area/Tests
Area/Tooling
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Lang/Python
Lang/Rust
Lang/Shell
Lang/SQL
Lang/TypeScript
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Routing
Auto
Routing
Hold
Routing
Human
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Grimoirix/grimoire-of-digital-signage!222
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/GRI-2074-playlist-add-from-library-pages"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Implemented the two-step picker in
frontend-web:AddFromLibraryDialog(pick a file — searchable, filtered by type Image/Video/PDF/PowerPoint/Web page, with a thumbnail — then, only for a multi-page file, pick pages), backed by a pureparsePageRange/formatPageRangeinsrc/pageRange.ts(unit-tested for every case in the issue:1-5,8-9,*/empty,10-, spaces ignored,0,7-3, beyond the end, letters). Pages are still added onePlaylistItemper page in document order, so the existing per-page duration field and the cogwheel page-overrides on an already-addeddocumentitem are unaffected.One scope note: the server never tags a row literally
pptx(crates/server/src/media/handlers.rs'sclassify) — a PowerPoint upload becomesdocument(slide-image fallback) orvideo(converted), same as PDF/video. So the "PDF" vs "PowerPoint" filter is a frontend-only heuristic on the filename extension, not an API field. Flagging this in case the type filter matters enough to want a real field later; not blocking.Test plan
frontend-web: prettier,oxlint --deny-warnings,tsc -b, vitest all green (94/94, including newpageRange.test.tsandAddFromLibraryDialog.test.tsx, plus twoPlaylistsScreen.test.tsxcases updated for the new two-step flow)./scripts/local-gates.sh(full suite, includingcargoworkspace andcargo-deny) greenChanges requested — one regression, three small items. CI is green and the branch is up to date with
dev; the parser and the two-step flow are good.1. Blocking: a document can no longer be added whole.
Before this PR the picker offered
handbook.pdf (all pages)— onedocumentitem. That is the only kind of item that has the cogwheel (PlaylistMediaTab.tsx:129,isDocument) and so the only way to reach per-page time and Skip this page (PageOverridesPanel). Now every multi-page file goes to the page step and always adds Ndocument_pageitems, so a new playlist can never get a cogwheel item. The cogwheel test still passes only because it seeds the item throughsessionStorage; the assertion that the "all pages" option exists was deleted fromPlaylistsScreen.test.tsx.Part of this is my fault: the #208 text says "one item per page … so Skip this page keeps working", and those two do not go together.
Fix: in the page step, add a button Add whole document (one
documentitem, page settings via the cogwheel) next to Add N pages. Keep a test that adds the whole document from the picker and then opens its cogwheel.2. Add is enabled while the range is invalid. With an error shown (e.g.
7-3) the selection keeps the last valid range and Add N pages still adds it. Disable the button whilerangeErroris set.3. Page step loads every page at full size. 50
<img src=/api/v1/media/{id}/file>at once for one file. Addloading="lazy"(and the same on the file-step thumbnails).4. Minor:
parsePageRange(text, file.pages.length)assumes pages are numbered 1..N without gaps, while the selection is keyed bypageNumber. Fine today; a one-line comment saying so is enough.The PDF/PowerPoint filter by file extension is fine for now.
All three points fixed at
78a4e8f: Add whole document adds the single document item (cogwheel path kept), Add disabled on an invalid range, page images lazy. Tests cover the first two. CI green, up to date with dev.