You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Agent] PTZ: UI to save presets and set home position #658
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/preset with 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-home saves the current position as home (handle_ptz_set_home).
Both require AUTHZ_PTZ_CONTROL and are audit-logged. Routes are in src/web/libuv_api_handlers.c:229-238.
The UI already has: move, stop, home, GET /ptz/presets, and POST /ptz/goto-preset (fixed in 38e90865).
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/capabilities says 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.json under live.*.
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 fetch mocked, 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.
Activity