mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-19 22:58:22 +03:00
tweaks
This commit is contained in:
parent
5f262621c4
commit
edc980ab8b
@ -26,6 +26,7 @@
|
|||||||
"globalDetect": "Object Detection",
|
"globalDetect": "Object Detection",
|
||||||
"globalRecording": "Recording",
|
"globalRecording": "Recording",
|
||||||
"globalSnapshots": "Snapshots",
|
"globalSnapshots": "Snapshots",
|
||||||
|
"globalFfmpeg": "FFmpeg",
|
||||||
"globalMotion": "Motion detection",
|
"globalMotion": "Motion detection",
|
||||||
"globalObjects": "Objects",
|
"globalObjects": "Objects",
|
||||||
"globalReview": "Review",
|
"globalReview": "Review",
|
||||||
|
|||||||
@ -4,6 +4,12 @@ const detectors: SectionConfigOverrides = {
|
|||||||
base: {
|
base: {
|
||||||
fieldOrder: [],
|
fieldOrder: [],
|
||||||
advancedFields: [],
|
advancedFields: [],
|
||||||
|
hiddenFields: [
|
||||||
|
"*.model.labelmap",
|
||||||
|
"*.model.attributes_map",
|
||||||
|
"*.model",
|
||||||
|
"*.model_path",
|
||||||
|
],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,9 @@ const live: SectionConfigOverrides = {
|
|||||||
hiddenFields: ["enabled_in_config"],
|
hiddenFields: ["enabled_in_config"],
|
||||||
advancedFields: ["quality"],
|
advancedFields: ["quality"],
|
||||||
},
|
},
|
||||||
|
global: {
|
||||||
|
hiddenFields: ["streams"],
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default live;
|
export default live;
|
||||||
|
|||||||
@ -40,6 +40,9 @@ const objects: SectionConfigOverrides = {
|
|||||||
suppressMultiSchema: true,
|
suppressMultiSchema: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
prompt: {
|
||||||
|
"ui:widget": "textarea",
|
||||||
|
},
|
||||||
required_zones: {
|
required_zones: {
|
||||||
"ui:widget": "zoneNames",
|
"ui:widget": "zoneNames",
|
||||||
"ui:options": {
|
"ui:options": {
|
||||||
@ -52,6 +55,9 @@ const objects: SectionConfigOverrides = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
global: {
|
||||||
|
hiddenFields: ["genai.required_zones"],
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default objects;
|
export default objects;
|
||||||
|
|||||||
@ -19,11 +19,8 @@ import { ConfigFormContext } from "@/types/configForm";
|
|||||||
* provided by RJSF. This avoids ambiguity with underscores in field names and
|
* provided by RJSF. This avoids ambiguity with underscores in field names and
|
||||||
* skips dynamic filter labels for per-object filter fields.
|
* skips dynamic filter labels for per-object filter fields.
|
||||||
*/
|
*/
|
||||||
function buildTranslationPath(path: Array<string | number>): string {
|
function buildTranslationPath(segments: string[], sectionI18nPrefix?: string) {
|
||||||
const segments = path.filter(
|
// Example: filters.person.threshold -> filters.threshold or ov1.model -> model
|
||||||
(segment): segment is string => typeof segment === "string",
|
|
||||||
);
|
|
||||||
|
|
||||||
const filtersIndex = segments.indexOf("filters");
|
const filtersIndex = segments.indexOf("filters");
|
||||||
if (filtersIndex !== -1 && segments.length > filtersIndex + 2) {
|
if (filtersIndex !== -1 && segments.length > filtersIndex + 2) {
|
||||||
const normalized = [
|
const normalized = [
|
||||||
@ -33,6 +30,22 @@ function buildTranslationPath(path: Array<string | number>): string {
|
|||||||
return normalized.join(".");
|
return normalized.join(".");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Example: detectors.ov1.type -> detectors.type
|
||||||
|
const detectorsIndex = segments.indexOf("detectors");
|
||||||
|
if (detectorsIndex !== -1 && segments.length > detectorsIndex + 2) {
|
||||||
|
const normalized = [
|
||||||
|
...segments.slice(0, detectorsIndex + 1),
|
||||||
|
...segments.slice(detectorsIndex + 2),
|
||||||
|
];
|
||||||
|
return normalized.join(".");
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we are in the detectors section but 'detectors' is not in the path (specialized section)
|
||||||
|
// then the first segment is the dynamic detector name.
|
||||||
|
if (sectionI18nPrefix === "detectors" && segments.length > 1) {
|
||||||
|
return segments.slice(1).join(".");
|
||||||
|
}
|
||||||
|
|
||||||
return segments.join(".");
|
return segments.join(".");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,7 +143,7 @@ export function FieldTemplate(props: FieldTemplateProps) {
|
|||||||
const pathSegments = fieldPathId.path.filter(
|
const pathSegments = fieldPathId.path.filter(
|
||||||
(segment): segment is string => typeof segment === "string",
|
(segment): segment is string => typeof segment === "string",
|
||||||
);
|
);
|
||||||
const translationPath = buildTranslationPath(pathSegments);
|
const translationPath = buildTranslationPath(pathSegments, sectionI18nPrefix);
|
||||||
const filterObjectLabel = getFilterObjectLabel(pathSegments);
|
const filterObjectLabel = getFilterObjectLabel(pathSegments);
|
||||||
const translatedFilterObjectLabel = filterObjectLabel
|
const translatedFilterObjectLabel = filterObjectLabel
|
||||||
? getTranslatedLabel(filterObjectLabel, "object")
|
? getTranslatedLabel(filterObjectLabel, "object")
|
||||||
|
|||||||
@ -63,7 +63,7 @@ export function WrapIfAdditionalTemplate<
|
|||||||
className={cn("grid grid-cols-12 items-start gap-2", classNames)}
|
className={cn("grid grid-cols-12 items-start gap-2", classNames)}
|
||||||
style={style}
|
style={style}
|
||||||
>
|
>
|
||||||
<div className="col-span-12 space-y-2 md:col-span-5">
|
<div className="col-span-12 space-y-2 md:col-span-1">
|
||||||
{displayLabel && <Label htmlFor={keyId}>{keyLabel}</Label>}
|
{displayLabel && <Label htmlFor={keyId}>{keyLabel}</Label>}
|
||||||
<Input
|
<Input
|
||||||
id={keyId}
|
id={keyId}
|
||||||
@ -75,11 +75,11 @@ export function WrapIfAdditionalTemplate<
|
|||||||
onBlur={!readonly ? onKeyRenameBlur : undefined}
|
onBlur={!readonly ? onKeyRenameBlur : undefined}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-span-12 space-y-2 md:col-span-6">
|
<div className="col-span-12 space-y-2 md:col-span-10">
|
||||||
{displayLabel && <Label htmlFor={id}>{valueLabel}</Label>}
|
{displayLabel && <Label htmlFor={id}>{valueLabel}</Label>}
|
||||||
<div className="min-w-0">{children}</div>
|
<div className="min-w-0">{children}</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-span-12 flex items-center md:col-span-1 md:justify-end">
|
<div className="col-span-12 flex items-center md:col-span-1 md:justify-center">
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
|
|||||||
@ -86,6 +86,7 @@ const allSettingsViews = [
|
|||||||
"globalDetect",
|
"globalDetect",
|
||||||
"globalRecording",
|
"globalRecording",
|
||||||
"globalSnapshots",
|
"globalSnapshots",
|
||||||
|
"globalFfmpeg",
|
||||||
"globalMotion",
|
"globalMotion",
|
||||||
"globalObjects",
|
"globalObjects",
|
||||||
"globalReview",
|
"globalReview",
|
||||||
@ -163,6 +164,7 @@ const createSectionPage = (
|
|||||||
const GlobalDetectSettingsPage = createSectionPage("detect", "global");
|
const GlobalDetectSettingsPage = createSectionPage("detect", "global");
|
||||||
const GlobalRecordingSettingsPage = createSectionPage("record", "global");
|
const GlobalRecordingSettingsPage = createSectionPage("record", "global");
|
||||||
const GlobalSnapshotsSettingsPage = createSectionPage("snapshots", "global");
|
const GlobalSnapshotsSettingsPage = createSectionPage("snapshots", "global");
|
||||||
|
const GlobalFfmpegSettingsPage = createSectionPage("ffmpeg", "global");
|
||||||
const GlobalMotionSettingsPage = createSectionPage("motion", "global");
|
const GlobalMotionSettingsPage = createSectionPage("motion", "global");
|
||||||
const GlobalObjectsSettingsPage = createSectionPage("objects", "global");
|
const GlobalObjectsSettingsPage = createSectionPage("objects", "global");
|
||||||
const GlobalReviewSettingsPage = createSectionPage("review", "global");
|
const GlobalReviewSettingsPage = createSectionPage("review", "global");
|
||||||
@ -264,6 +266,7 @@ const settingsGroups = [
|
|||||||
{ key: "globalDetect", component: GlobalDetectSettingsPage },
|
{ key: "globalDetect", component: GlobalDetectSettingsPage },
|
||||||
{ key: "globalRecording", component: GlobalRecordingSettingsPage },
|
{ key: "globalRecording", component: GlobalRecordingSettingsPage },
|
||||||
{ key: "globalSnapshots", component: GlobalSnapshotsSettingsPage },
|
{ key: "globalSnapshots", component: GlobalSnapshotsSettingsPage },
|
||||||
|
{ key: "globalFfmpeg", component: GlobalFfmpegSettingsPage },
|
||||||
{ key: "globalMotion", component: GlobalMotionSettingsPage },
|
{ key: "globalMotion", component: GlobalMotionSettingsPage },
|
||||||
{ key: "globalObjects", component: GlobalObjectsSettingsPage },
|
{ key: "globalObjects", component: GlobalObjectsSettingsPage },
|
||||||
{ key: "globalReview", component: GlobalReviewSettingsPage },
|
{ key: "globalReview", component: GlobalReviewSettingsPage },
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user