From edc980ab8b1e597997ae49ec4c83075e86d0fe2b Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Mon, 2 Feb 2026 08:34:46 -0600 Subject: [PATCH] tweaks --- web/public/locales/en/views/settings.json | 1 + .../config-form/section-configs/detectors.ts | 6 +++++ .../config-form/section-configs/live.ts | 3 +++ .../config-form/section-configs/objects.ts | 6 +++++ .../theme/templates/FieldTemplate.tsx | 25 ++++++++++++++----- .../templates/WrapIfAdditionalTemplate.tsx | 6 ++--- web/src/pages/Settings.tsx | 3 +++ 7 files changed, 41 insertions(+), 9 deletions(-) diff --git a/web/public/locales/en/views/settings.json b/web/public/locales/en/views/settings.json index 4cf54d2b9..ae3066014 100644 --- a/web/public/locales/en/views/settings.json +++ b/web/public/locales/en/views/settings.json @@ -26,6 +26,7 @@ "globalDetect": "Object Detection", "globalRecording": "Recording", "globalSnapshots": "Snapshots", + "globalFfmpeg": "FFmpeg", "globalMotion": "Motion detection", "globalObjects": "Objects", "globalReview": "Review", diff --git a/web/src/components/config-form/section-configs/detectors.ts b/web/src/components/config-form/section-configs/detectors.ts index a8259015b..40f8c20de 100644 --- a/web/src/components/config-form/section-configs/detectors.ts +++ b/web/src/components/config-form/section-configs/detectors.ts @@ -4,6 +4,12 @@ const detectors: SectionConfigOverrides = { base: { fieldOrder: [], advancedFields: [], + hiddenFields: [ + "*.model.labelmap", + "*.model.attributes_map", + "*.model", + "*.model_path", + ], }, }; diff --git a/web/src/components/config-form/section-configs/live.ts b/web/src/components/config-form/section-configs/live.ts index bec5c0d7e..ac8e52472 100644 --- a/web/src/components/config-form/section-configs/live.ts +++ b/web/src/components/config-form/section-configs/live.ts @@ -7,6 +7,9 @@ const live: SectionConfigOverrides = { hiddenFields: ["enabled_in_config"], advancedFields: ["quality"], }, + global: { + hiddenFields: ["streams"], + }, }; export default live; diff --git a/web/src/components/config-form/section-configs/objects.ts b/web/src/components/config-form/section-configs/objects.ts index 7652aff22..8c6fe4097 100644 --- a/web/src/components/config-form/section-configs/objects.ts +++ b/web/src/components/config-form/section-configs/objects.ts @@ -40,6 +40,9 @@ const objects: SectionConfigOverrides = { suppressMultiSchema: true, }, }, + prompt: { + "ui:widget": "textarea", + }, required_zones: { "ui:widget": "zoneNames", "ui:options": { @@ -52,6 +55,9 @@ const objects: SectionConfigOverrides = { }, }, }, + global: { + hiddenFields: ["genai.required_zones"], + }, }; export default objects; diff --git a/web/src/components/config-form/theme/templates/FieldTemplate.tsx b/web/src/components/config-form/theme/templates/FieldTemplate.tsx index 1c1161967..f0a89cc01 100644 --- a/web/src/components/config-form/theme/templates/FieldTemplate.tsx +++ b/web/src/components/config-form/theme/templates/FieldTemplate.tsx @@ -19,11 +19,8 @@ import { ConfigFormContext } from "@/types/configForm"; * provided by RJSF. This avoids ambiguity with underscores in field names and * skips dynamic filter labels for per-object filter fields. */ -function buildTranslationPath(path: Array): string { - const segments = path.filter( - (segment): segment is string => typeof segment === "string", - ); - +function buildTranslationPath(segments: string[], sectionI18nPrefix?: string) { + // Example: filters.person.threshold -> filters.threshold or ov1.model -> model const filtersIndex = segments.indexOf("filters"); if (filtersIndex !== -1 && segments.length > filtersIndex + 2) { const normalized = [ @@ -33,6 +30,22 @@ function buildTranslationPath(path: Array): string { 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("."); } @@ -130,7 +143,7 @@ export function FieldTemplate(props: FieldTemplateProps) { const pathSegments = fieldPathId.path.filter( (segment): segment is string => typeof segment === "string", ); - const translationPath = buildTranslationPath(pathSegments); + const translationPath = buildTranslationPath(pathSegments, sectionI18nPrefix); const filterObjectLabel = getFilterObjectLabel(pathSegments); const translatedFilterObjectLabel = filterObjectLabel ? getTranslatedLabel(filterObjectLabel, "object") diff --git a/web/src/components/config-form/theme/templates/WrapIfAdditionalTemplate.tsx b/web/src/components/config-form/theme/templates/WrapIfAdditionalTemplate.tsx index 7755643c5..284b713d9 100644 --- a/web/src/components/config-form/theme/templates/WrapIfAdditionalTemplate.tsx +++ b/web/src/components/config-form/theme/templates/WrapIfAdditionalTemplate.tsx @@ -63,7 +63,7 @@ export function WrapIfAdditionalTemplate< className={cn("grid grid-cols-12 items-start gap-2", classNames)} style={style} > -
+
{displayLabel && }
-
+
{displayLabel && }
{children}
-
+