mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-13 11:57:36 +03:00
formatting
This commit is contained in:
parent
a0849b104c
commit
98e9e79881
@ -566,9 +566,7 @@ function removePropertyBySegments(
|
||||
if (segments.length === 0 || !isSchemaObject(schema)) return;
|
||||
|
||||
const [head, ...rest] = segments;
|
||||
const props = schema.properties as
|
||||
| Record<string, RJSFSchema>
|
||||
| undefined;
|
||||
const props = schema.properties as Record<string, RJSFSchema> | undefined;
|
||||
|
||||
if (rest.length === 0) {
|
||||
// Terminal segment — delete the property
|
||||
@ -594,10 +592,7 @@ function removePropertyBySegments(
|
||||
if (head === "*") {
|
||||
// Wildcard segment — descend into additionalProperties
|
||||
if (isSchemaObject(schema.additionalProperties)) {
|
||||
removePropertyBySegments(
|
||||
schema.additionalProperties as RJSFSchema,
|
||||
rest,
|
||||
);
|
||||
removePropertyBySegments(schema.additionalProperties as RJSFSchema, rest);
|
||||
}
|
||||
} else if (props && head in props && isSchemaObject(props[head])) {
|
||||
removePropertyBySegments(props[head], rest);
|
||||
|
||||
@ -515,9 +515,13 @@ const CAMERA_SECTION_MAPPING: Record<string, SettingsType> = {
|
||||
};
|
||||
|
||||
// Reverse mapping: page key → config section key
|
||||
const REVERSE_CAMERA_SECTION_MAPPING: Record<string, string> = Object.fromEntries(
|
||||
Object.entries(CAMERA_SECTION_MAPPING).map(([section, page]) => [page, section]),
|
||||
);
|
||||
const REVERSE_CAMERA_SECTION_MAPPING: Record<string, string> =
|
||||
Object.fromEntries(
|
||||
Object.entries(CAMERA_SECTION_MAPPING).map(([section, page]) => [
|
||||
page,
|
||||
section,
|
||||
]),
|
||||
);
|
||||
// masksAndZones is a composite page, not in CAMERA_SECTION_MAPPING
|
||||
REVERSE_CAMERA_SECTION_MAPPING["masksAndZones"] = "masksAndZones";
|
||||
|
||||
@ -1153,9 +1157,7 @@ export default function Settings() {
|
||||
return !!(hasZones || hasMotionMasks || hasObjectMasks);
|
||||
}
|
||||
|
||||
return !!profileData[
|
||||
currentSectionKey as keyof typeof profileData
|
||||
];
|
||||
return !!profileData[currentSectionKey as keyof typeof profileData];
|
||||
},
|
||||
[config, selectedCamera, currentSectionKey],
|
||||
);
|
||||
|
||||
@ -208,10 +208,7 @@ export function buildOverrides(
|
||||
|
||||
// lodash `unset` treats `*` as a literal key. This helper expands wildcard
|
||||
// segments so that e.g. `"filters.*.mask"` unsets `filters.<each key>.mask`.
|
||||
function unsetWithWildcard(
|
||||
obj: Record<string, unknown>,
|
||||
path: string,
|
||||
): void {
|
||||
function unsetWithWildcard(obj: Record<string, unknown>, path: string): void {
|
||||
if (!path.includes("*")) {
|
||||
unset(obj, path);
|
||||
return;
|
||||
@ -224,10 +221,7 @@ function unsetWithWildcard(
|
||||
if (parent && typeof parent === "object") {
|
||||
for (const key of Object.keys(parent as Record<string, unknown>)) {
|
||||
const fullPath = suffix ? `${key}.${suffix}` : key;
|
||||
unsetWithWildcard(
|
||||
parent as Record<string, unknown>,
|
||||
fullPath,
|
||||
);
|
||||
unsetWithWildcard(parent as Record<string, unknown>, fullPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user