GRI-2098: panel conversion progress for PDF/PPTX uploads (#233 part 2) #265
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!265
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/GRI-2098-conversion-progress"
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?
Panel side of #233 part 2 (GRI-2098), built against the contract Vivy posted
on the issue and PR #264 (not merged yet — see below).
What changed
A
.pdf/.pptxupload's row is a placeholder until its background jobresolves it: a
documentwithpageCount: null, orpendingfor a.pptxnot yet known to bedocumentorvideo. The panel now pollsGET /media/{id}/jobfor any such item and shows:Converting to PDF, Rendering pages, Encoding video);
<reason>onstate: "failed", including theerror_step: "interrupted"case (server restart) — same generichandling, no special-casing needed.
The item can still be deleted while converting or after a failure (closing
a failed item specifically is #236, out of scope here).
Mock mode
mockMediaApi.tsnow simulates the same placeholder-then-job shape (a.pptxupload it previously rejected outright now works, resolving tovideo), computed from elapsed wall-clock time rather than a runningtimer — nothing to clean up, and deterministic to drive with fake timers
in tests. A filename containing
failforces the simulated job to fail,for tests and for trying the failure path in
npm run dev:mock.Against #264, not merged yet
PR #264 (forge #263) isn't merged, so this is built from its documented
contract (
job_state,GET /media/{id}/job'sstate/page/page_total/error_step/error_message) and the mock stands in for it — same as anyother panel work against a not-yet-landed backend contract.
httpMediaApitalks to the real route either way; nothing here needs changing once #264
lands.
Tests
httpMediaApi.test.ts/mockMediaApi.test.ts:getMediaJobagainst bothimplementations (in-progress, failed, 404).
MediaScreen.test.tsx: theexisting PDF-grouping test updated for the now-async placeholder (was
previously synchronous), plus new coverage for a PPTX resolving to video
and a failed conversion's error display with delete still available.
Checked at the repo's existing breakpoints via the design system's
responsive list/card classes (
gx-list-item,gx-card,gx-progress) —no new CSS, tokens or custom components, so no new light/dark or
zoom-to-200% risk beyond what those already carry. Keyboard access is the
existing Delete button; the new status/error text uses
role="status"/role="alert", matching the upload-progress and error patterns already inthis screen.
Contract matches
GET /media/{media_id}/jobon dev (13f1f05c) — field names, states,interruptedaserror_step. Two changes before merge:JOB_POLL_INTERVAL_MS = 150is too fast for production. An 83-slide deck converts for 5+ minutes on the test server: that is ~2000 requests per converting item, per open panel, each one a DB read through the auth and campus checks. Use ~1500 ms in the product. If the tests need speed, make the interval a parameter or use fake timers (vi.useFakeTimers()+advanceTimersByTimeAsync) — do not tune the product for the test.A transient error stops the poll for ever.
catch { return }treats a network blip or a 502 during a redeploy the same as a 404. The row then shows a stale step label until the user reloads, and the id stays inpolledJobIdsRef, so it is never polled again. Return only onApiRequestErrorwith status 404; on any other error wait the interval and try again (a small retry cap is fine).Everything else is fine: no list flash on done (
refreshItemsOnly), unmount guard, failed state shows the server message, delete stays available on a converting row.Both points fixed on
62c646a2: poll is 1500 ms (test override only), and only a not_found stops the poll; other errors wait one interval and retry, with a test. Server returns code not_found for a missing job. CI green on all 7 required contexts. Approved.