mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-11-30 01:07:07 +03:00
don't strip the fallback detect size when cloning
This commit is contained in:
@@ -19,19 +19,8 @@
|
|||||||
* and no PUT. That path is covered by unit-level review and manual QA.
|
* and no PUT. That path is covered by unit-level review and manual QA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { readFileSync } from "node:fs";
|
|
||||||
import { resolve, dirname } from "node:path";
|
|
||||||
import { fileURLToPath } from "node:url";
|
|
||||||
import { test, expect } from "../fixtures/frigate-test";
|
import { test, expect } from "../fixtures/frigate-test";
|
||||||
|
|
||||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
||||||
const CONFIG_SCHEMA = JSON.parse(
|
|
||||||
readFileSync(
|
|
||||||
resolve(__dirname, "../fixtures/mock-data/config-schema.json"),
|
|
||||||
"utf-8",
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
async function openCloneDialog(frigateApp: {
|
async function openCloneDialog(frigateApp: {
|
||||||
page: import("@playwright/test").Page;
|
page: import("@playwright/test").Page;
|
||||||
}) {
|
}) {
|
||||||
@@ -148,43 +137,6 @@ test.describe("Camera clone dialog @medium @mobile", () => {
|
|||||||
).toBeVisible({ timeout: 8_000 });
|
).toBeVisible({ timeout: 8_000 });
|
||||||
});
|
});
|
||||||
|
|
||||||
test("does not copy a fallback detect resolution to a new camera", async ({
|
|
||||||
frigateApp,
|
|
||||||
}) => {
|
|
||||||
await frigateApp.installDefaults({
|
|
||||||
config: {
|
|
||||||
cameras: { front_door: { detect_resolution_source: "default" } },
|
|
||||||
},
|
|
||||||
});
|
|
||||||
// section payloads need the schema, which the default mock leaves empty
|
|
||||||
await frigateApp.page.route("**/api/config/schema.json", (route) =>
|
|
||||||
route.fulfill({ json: CONFIG_SCHEMA }),
|
|
||||||
);
|
|
||||||
const requests: unknown[] = [];
|
|
||||||
await frigateApp.page.route("**/api/config/set", async (route) => {
|
|
||||||
requests.push(route.request().postDataJSON());
|
|
||||||
await route.fulfill({ json: { success: true, require_restart: false } });
|
|
||||||
});
|
|
||||||
|
|
||||||
await frigateApp.goto("/settings?page=cameraManagement");
|
|
||||||
await openCloneDialog(frigateApp);
|
|
||||||
await selectSource(frigateApp, "Front Door");
|
|
||||||
await frigateApp.page
|
|
||||||
.getByPlaceholder(/e\.g\., back_door or Back Door/i)
|
|
||||||
.fill("clone_target_two");
|
|
||||||
await frigateApp.page.getByRole("button", { name: /^Clone$/i }).click();
|
|
||||||
|
|
||||||
await expect.poll(() => requests.length, { timeout: 10_000 }).toBe(1);
|
|
||||||
const body = requests[0] as {
|
|
||||||
config_data: {
|
|
||||||
cameras: { clone_target_two: { detect?: Record<string, unknown> } };
|
|
||||||
};
|
|
||||||
};
|
|
||||||
const detect = body.config_data.cameras.clone_target_two.detect ?? {};
|
|
||||||
expect(detect).not.toHaveProperty("width");
|
|
||||||
expect(detect).not.toHaveProperty("height");
|
|
||||||
});
|
|
||||||
|
|
||||||
test("selects multiple existing destination cameras via a switch popover", async ({
|
test("selects multiple existing destination cameras via a switch popover", async ({
|
||||||
frigateApp,
|
frigateApp,
|
||||||
}) => {
|
}) => {
|
||||||
|
|||||||
@@ -672,14 +672,9 @@ export function buildClonedCameraPayloads({
|
|||||||
formData: sourceSectionValue as ConfigSectionData,
|
formData: sourceSectionValue as ConfigSectionData,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
// a fallback detect size would become an explicit value on the target
|
|
||||||
const fallbackDetect =
|
|
||||||
section === "detect" && sourceCfg.detect_resolution_source === "default"
|
|
||||||
? ["width", "height"]
|
|
||||||
: [];
|
|
||||||
let pendingSectionValue: unknown = sanitizeSectionData(
|
let pendingSectionValue: unknown = sanitizeSectionData(
|
||||||
cloneDeep(sourceSectionValue) as ConfigSectionData,
|
cloneDeep(sourceSectionValue) as ConfigSectionData,
|
||||||
[...resolvedHiddenFields, ...fallbackDetect],
|
resolvedHiddenFields,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (FILTER_SECTION_DEFS[section]) {
|
if (FILTER_SECTION_DEFS[section]) {
|
||||||
|
|||||||
Reference in New Issue
Block a user