GRI-2111: panel Campus selector for moving media between campuses (#242) #254
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!254
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/GRI-2111-media-campus-selector"
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
Panel half of #242: a global admin can move a media item (or a whole document, all pages at once) between campuses from the media library, using the
PATCH /api/v1/media/{id}contract pinned on #244.user.campusId === null(global admin) — the same conventionNewPlaylistDialogalready uses.moveMediaCampus(mediaId, campusId). A document's selector moves every page with it (noted next to the selector).409 media_in_use_by_other_campusresponse shows the playlists that would lose the item and asks to confirm removing it from them and moving, mirroring the existingmedia_in_use/delete conflict flow (GRI-1962).MediaItem.campusIdand the wire'scampus_idwere added — the server already returns this field (crates/server/src/media/handlers.rs), the frontend type just hadn't picked it up yet.Backend route: #244 (aetherforge). Acceptance tests for the backend/server contract: #245 (test/GRI-2115, already in
dev). This PR's own tests are the frontend's: a global admin sees the selector and a campus admin does not, a move succeeds, a document move notes every page moves, the 409 conflict names the playlists and offers remove-and-move, cancelling leaves the item alone, and a generic error falls back to a generic message.Merge waits for #244 to land, per the chief of staff's routing on GRI-72 (board comment, GRI-2111).
Test plan
npm run checkinfrontend-web(prettier, oxlint, tsc, vitest) — all green.npm run buildinfrontend-web— builds.scripts/local-gates.sh --frontend-onlyrun locally — every gate passed.listCampuses()fills in once latency resolves and the "All campuses" option is always present first.gx-input/gx-fieldclasses shared with every other form control on this screen.<select>with its own<label>, keyed per item by its own id (not a shared label), so it is independently reachable and announced; the conflict dialog reuses the existingalertdialog/alertpattern with visible focusable buttons.Panel built against the contract in #244 (not waiting for it to land, per the chief of staff's GRI-72 routing tonight). Frontend-only change: Campus selector on each media item, visible to a global admin only, with the 409 conflict/remove-and-move flow mirroring the existing delete conflict. Own acceptance tests added in a separate commit before the implementation commit.
npm run check+npm run build+ fullscripts/local-gates.sh --frontend-onlyall green locally; forge CI running now. Merge waits for #244.Close, two fixes:
This merges after #253 (the server endpoint), not before.
Addressed both review points (commit
6fcf85c):canMoveCampusnow readsuser.isAdmininstead ofuser.campusId === null— a non-admin with no campus assigned no longer sees the selector. Added a test (hides the Campus selector from a non-admin even when their campusId is null).listCampuses().then(setCampuses)now has a.catchthat sets the load error state, same message pattern asrefresh(). Added a test covering the failure path.npm run check(127 tests) andnpm run buildgreen; fullscripts/local-gates.sh --frontend-onlygreen. CI running on the pull request.Re-reviewed
6fcf85c7.canMoveCampusnow usesuser.isAdmin, the same check the server makes, and a failed campus list now shows an error instead of failing silently. The panel sendscampus_id: nullexplicitly, which matches the new required field in #253. CI is green.One small thing, not a blocker: a failed campus list replaces the whole Media screen with the error, so an admin cannot see their media until the reload works. A notice next to the Campus selector would hurt less. Fix it in a follow-up if you agree.
Approved. Merges after #253.
New commits pushed, approval review dismissed automatically according to repository settings