This commit is contained in:
Josh Hawkins 2026-06-09 16:24:16 -05:00
parent 50591cb2fa
commit 470abbab9d
3 changed files with 18 additions and 2 deletions

View File

@ -148,6 +148,20 @@ test.describe("Camera wizard PTZ pane @medium @mobile", () => {
).toBeDisabled();
});
test("shows the pane but leaves the switch off when no presets are found", async ({
frigateApp,
}) => {
await mockProbe(frigateApp.page, { ...PTZ_PROBE, presets_count: 0 });
const dialog = await gotoStep3(frigateApp.page);
await expect(
dialog.getByText("Enable PTZ Controls", { exact: true }),
).toBeVisible();
await expect(ptzSwitch(dialog)).not.toBeChecked();
// with the switch off, the connection fields are not shown
await expect(dialog.getByPlaceholder("192.168.1.100")).toHaveCount(0);
});
test("hides the PTZ pane when the probe reports no PTZ support", async ({
frigateApp,
}) => {

View File

@ -406,7 +406,7 @@
},
"ptz": {
"title": "Enable PTZ Controls",
"detectedNote": "PTZ support has been detected via ONVIF.",
"detectedNote": "PTZ support has been detected via ONVIF. If this is a PTZ camera, enabling this option will allow you to control the camera's pan/tilt/zoom functions from the UI.",
"connectionDetails": "ONVIF connection details",
"host": "ONVIF Host",
"port": "ONVIF Port",

View File

@ -78,6 +78,7 @@ export default function Step3StreamConfig({
const onvif = wizardData.onvif;
const ptzSupported = wizardData.probeResult?.ptz_supported === true;
const hasPresets = (wizardData.probeResult?.presets_count ?? 0) > 0;
const onvifInvalid = !!onvif?.enabled && (!onvif.host?.trim() || !onvif.port);
// Seed the PTZ pane once from the successful ONVIF probe
@ -86,7 +87,7 @@ export default function Step3StreamConfig({
if (ptzSupported && wizardData.onvif === undefined) {
onUpdate({
onvif: {
enabled: true,
enabled: hasPresets,
host: wizardData.host ?? "",
port: wizardData.onvifPort ?? 8000,
user: wizardData.username ?? "",
@ -96,6 +97,7 @@ export default function Step3StreamConfig({
}
}, [
ptzSupported,
hasPresets,
wizardData.onvif,
wizardData.host,
wizardData.onvifPort,