GRI-2190: panel for the assign-playlist replace/campus-mismatch contract (forge #310) #319

Merged
vivy merged 1 commit from feature/GRI-2190-playlist-devices-panel into dev 2026-11-18 01:52:15 +00:00
Member

Panel half of forge #310, after the server contract (GRI-2201, merged to dev at c3e062a) and the server fail-first tests (GRI-2200/#315).

PlaylistDevicesTab.tsx (playlist editor's Devices tab)

A device's checkbox is disabled, with a reason in its label, when:

  • it already shows another playlist — (on <playlist name>), from GET /device-playlist-assignments (every device's assignment, not just this playlist's);
  • its campus does not match this playlist's campus — (different campus).

Saving still sends replace: false (the default) for newly ticked devices — unchanged, since a disabled checkbox already keeps a conflicting device out of the selection. The save error now shows the server's own message (e.g. a 409 from a race) instead of a generic one.

DevicesScreen.tsx

Adds a playlist selector per approved device, gated on content_assign (the permission assign_playlist requires), filtered to playlists of the device's own campus or open to every campus (mirrors the server's campus check). Choosing a playlist:

  • assigns directly (replace: false) when the device shows none yet;
  • asks "<device> shows <A>. Move it to <B>?" first when it already shows one, and only sends replace: true on confirmation — mirrors the inline confirm pattern already used for playlist deletion (PlaylistSettingsTab.tsx).

API / types

  • assignPlaylistToDevice (httpPlaylistsApi.ts) takes an optional replace (default false) and sends it on the wire.
  • ApiErrorDetails gets current_playlist, device_campus, playlist_campus to match the server's device_already_assigned/campus_mismatch detail shapes.
  • mockPlaylistsApi.ts mirrors the server's checks (campus mismatch first, then already-assigned unless replace) so the mock-backed test suite exercises the real contract.

Verified

  • ./scripts/local-gates.sh --frontend-only green in the working tree (prettier, oxlint, tsc, vitest — 205 tests, build) before push.
  • New tests: PlaylistsScreen.test.tsx (disabled + reason for another-playlist and campus-mismatch devices), DevicesScreen.test.tsx (direct assign, move-confirm, cancel, campus-filtered selector, selector hidden without content_assign).
  • Checked manually in both themes is not applicable — no new colors/sizes were introduced; all styling reuses existing gx-* classes and tokens already used by the surrounding rows (campus select, delete confirm).
Panel half of forge #310, after the server contract (GRI-2201, merged to `dev` at c3e062a) and the server fail-first tests (GRI-2200/#315). ## PlaylistDevicesTab.tsx (playlist editor's Devices tab) A device's checkbox is disabled, with a reason in its label, when: - it already shows another playlist — `(on <playlist name>)`, from `GET /device-playlist-assignments` (every device's assignment, not just this playlist's); - its campus does not match this playlist's campus — `(different campus)`. Saving still sends `replace: false` (the default) for newly ticked devices — unchanged, since a disabled checkbox already keeps a conflicting device out of the selection. The save error now shows the server's own message (e.g. a 409 from a race) instead of a generic one. ## DevicesScreen.tsx Adds a playlist selector per approved device, gated on `content_assign` (the permission `assign_playlist` requires), filtered to playlists of the device's own campus or open to every campus (mirrors the server's campus check). Choosing a playlist: - assigns directly (`replace: false`) when the device shows none yet; - asks "`<device>` shows `<A>`. Move it to `<B>`?" first when it already shows one, and only sends `replace: true` on confirmation — mirrors the inline confirm pattern already used for playlist deletion (`PlaylistSettingsTab.tsx`). ## API / types - `assignPlaylistToDevice` (`httpPlaylistsApi.ts`) takes an optional `replace` (default `false`) and sends it on the wire. - `ApiErrorDetails` gets `current_playlist`, `device_campus`, `playlist_campus` to match the server's `device_already_assigned`/`campus_mismatch` detail shapes. - `mockPlaylistsApi.ts` mirrors the server's checks (campus mismatch first, then already-assigned unless `replace`) so the mock-backed test suite exercises the real contract. ## Verified - `./scripts/local-gates.sh --frontend-only` green in the working tree (prettier, oxlint, tsc, vitest — 205 tests, build) before push. - New tests: `PlaylistsScreen.test.tsx` (disabled + reason for another-playlist and campus-mismatch devices), `DevicesScreen.test.tsx` (direct assign, move-confirm, cancel, campus-filtered selector, selector hidden without `content_assign`). - Checked manually in both themes is not applicable — no new colors/sizes were introduced; all styling reuses existing `gx-*` classes and tokens already used by the surrounding rows (campus select, delete confirm).
GRI-2190: panel for the assign-playlist replace/campus-mismatch contract
All checks were successful
CI / the pre-push hook (pull_request) Successful in 3s
CI / cargo fmt (pull_request) Successful in 3s
CI / install.sh client upgrade (pull_request) Successful in 13s
CI / cargo deny (pull_request) Successful in 15s
CI / cargo deny advisories (pull_request) Successful in 15s
CI / repository boundary (pull_request) Successful in 4s
CI / cargo clippy (pull_request) Successful in 1m5s
CI / frontend-web (pull_request) Successful in 59s
CI / cargo test (pull_request) Successful in 3m14s
CI / Notify gate failed (pull_request) Has been skipped
CI / CI (pull_request) Successful in 1s
22c115147e
PlaylistDevicesTab disables a device already on another playlist, or of a
mismatching campus, naming the reason, instead of letting a tick steal a
device or cross a campus. DevicesScreen gets a playlist selector, filtered
to the device's own campus (or campus-open playlists), that assigns
directly when nothing is assigned yet and asks to confirm a move
(replace: true) when something already is.
vivy merged commit 56dd99caf0 into dev 2026-11-18 01:52:15 +00:00
vivy deleted branch feature/GRI-2190-playlist-devices-panel 2026-11-18 01:52:15 +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!319
No description provided.