mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-07-07 12:31:15 +03:00
tweaks
This commit is contained in:
parent
50591cb2fa
commit
470abbab9d
@ -148,6 +148,20 @@ test.describe("Camera wizard PTZ pane @medium @mobile", () => {
|
|||||||
).toBeDisabled();
|
).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 ({
|
test("hides the PTZ pane when the probe reports no PTZ support", async ({
|
||||||
frigateApp,
|
frigateApp,
|
||||||
}) => {
|
}) => {
|
||||||
|
|||||||
@ -406,7 +406,7 @@
|
|||||||
},
|
},
|
||||||
"ptz": {
|
"ptz": {
|
||||||
"title": "Enable PTZ Controls",
|
"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",
|
"connectionDetails": "ONVIF connection details",
|
||||||
"host": "ONVIF Host",
|
"host": "ONVIF Host",
|
||||||
"port": "ONVIF Port",
|
"port": "ONVIF Port",
|
||||||
|
|||||||
@ -78,6 +78,7 @@ export default function Step3StreamConfig({
|
|||||||
|
|
||||||
const onvif = wizardData.onvif;
|
const onvif = wizardData.onvif;
|
||||||
const ptzSupported = wizardData.probeResult?.ptz_supported === true;
|
const ptzSupported = wizardData.probeResult?.ptz_supported === true;
|
||||||
|
const hasPresets = (wizardData.probeResult?.presets_count ?? 0) > 0;
|
||||||
const onvifInvalid = !!onvif?.enabled && (!onvif.host?.trim() || !onvif.port);
|
const onvifInvalid = !!onvif?.enabled && (!onvif.host?.trim() || !onvif.port);
|
||||||
|
|
||||||
// Seed the PTZ pane once from the successful ONVIF probe
|
// Seed the PTZ pane once from the successful ONVIF probe
|
||||||
@ -86,7 +87,7 @@ export default function Step3StreamConfig({
|
|||||||
if (ptzSupported && wizardData.onvif === undefined) {
|
if (ptzSupported && wizardData.onvif === undefined) {
|
||||||
onUpdate({
|
onUpdate({
|
||||||
onvif: {
|
onvif: {
|
||||||
enabled: true,
|
enabled: hasPresets,
|
||||||
host: wizardData.host ?? "",
|
host: wizardData.host ?? "",
|
||||||
port: wizardData.onvifPort ?? 8000,
|
port: wizardData.onvifPort ?? 8000,
|
||||||
user: wizardData.username ?? "",
|
user: wizardData.username ?? "",
|
||||||
@ -96,6 +97,7 @@ export default function Step3StreamConfig({
|
|||||||
}
|
}
|
||||||
}, [
|
}, [
|
||||||
ptzSupported,
|
ptzSupported,
|
||||||
|
hasPresets,
|
||||||
wizardData.onvif,
|
wizardData.onvif,
|
||||||
wizardData.host,
|
wizardData.host,
|
||||||
wizardData.onvifPort,
|
wizardData.onvifPort,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user