mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-07-27 14:19:01 +03:00
CI / AMD64 Build (push) Has been cancelled
CI / ARM Build (push) Has been cancelled
CI / Jetson Jetpack 6 (push) Has been cancelled
CI / AMD64 Extra Build (push) Has been cancelled
CI / ARM Extra Build (push) Has been cancelled
CI / Synaptics Build (push) Has been cancelled
CI / Assemble and push default build (push) Has been cancelled
* add review padding to explore debug replay api calls * add semantic search model size widget disables model_size select with n/a text when an embeddings genai provider is selected * regenerate zone contours and per-zone filter masks on detect resolution change * treat null as a clear sentinel in buildOverrides so nullable field edits don't snap back * extract replay config sheet to new component * add validation and messages for detect settings
37 lines
989 B
TypeScript
37 lines
989 B
TypeScript
import type { FormValidation } from "@rjsf/utils";
|
|
import type { TFunction } from "i18next";
|
|
import { isJsonObject } from "@/lib/utils";
|
|
import type { JsonObject } from "@/types/configForm";
|
|
|
|
export function validateDetectDimensions(
|
|
formData: unknown,
|
|
errors: FormValidation,
|
|
t: TFunction,
|
|
): FormValidation {
|
|
if (!isJsonObject(formData as JsonObject)) {
|
|
return errors;
|
|
}
|
|
|
|
const data = formData as JsonObject;
|
|
const width = data.width;
|
|
const height = data.height;
|
|
|
|
const widthErrors = errors.width as
|
|
| { addError?: (message: string) => void }
|
|
| undefined;
|
|
const heightErrors = errors.height as
|
|
| { addError?: (message: string) => void }
|
|
| undefined;
|
|
|
|
const message = t("detect.dimensionMustBeEven", { ns: "config/validation" });
|
|
|
|
if (typeof width === "number" && width % 2 !== 0) {
|
|
widthErrors?.addError?.(message);
|
|
}
|
|
if (typeof height === "number" && height % 2 !== 0) {
|
|
heightErrors?.addError?.(message);
|
|
}
|
|
|
|
return errors;
|
|
}
|