Repository navigation
Closed
Labels
enhancementNew feature or requestNew feature or requestjavascriptPull requests that update javascript codePull requests that update javascript code
Description
Problem and evidence
The live-view PTZ controls (web/js/components/preact/PTZControls.jsx) can only use presets that already exist. The backend can create presets and set home, but the UI exposes neither:
PUT /api/streams/{name}/ptz/presetwith body{"name": "<preset name>"}saves the camera's current position as a new ONVIF preset and returns its token (src/web/api_handlers_ptz.c,handle_ptz_set_preset).POST /api/streams/{name}/ptz/set-homesaves the current position as home (handle_ptz_set_home).- Both require
AUTHZ_PTZ_CONTROLand are audit-logged. Routes are insrc/web/libuv_api_handlers.c:229-238. - The UI already has: move, stop, home,
GET /ptz/presets, andPOST /ptz/goto-preset(fixed in38e90865).
Expected behavior and scope
- In the PTZ panel, add "Save current position as preset…" (asks for a name, then refreshes the preset list on success) and "Set current position as home" (with confirmation).
- Hide or disable both when
GET /ptz/capabilitiessays presets or home aren't supported (check which capability fields exist), or when the user gets a 403. - Show success and failure with the existing toast pattern (
live.ptzPresetFailed-style keys). - New strings go in
en.jsonunderlive.*. - Optional, only if the backend already supports it: removing a preset. Don't add backend routes in this issue.
Acceptance criteria
- Saving a preset adds it to the dropdown without a page reload, and "Go to preset" then moves the camera there.
- Set-home followed by Home returns to the new position.
- Buttons are keyboard accessible with aria labels (jsx-a11y lint passes).
Validation
cd web && npx vite build,npm run lint,npm test.- Jest test with
fetchmocked, checking method, URL and body for both actions and the preset-list refresh. - Manual test on a real ONVIF PTZ camera if one is available. Mention in the PR if it was untested on hardware.
Constraints and rollback
- Frontend only.
- Rollback: revert.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestjavascriptPull requests that update javascript codePull requests that update javascript code
Activity