From 0b148d66f32e760879da2859765c6e72e70afead Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Tue, 27 Jan 2026 14:49:32 -0600 Subject: [PATCH] fix array field template --- web/public/locales/en/views/settings.json | 8 +++ .../config-form/sections/ReviewSection.tsx | 1 + .../config-form/theme/frigateTheme.ts | 2 + .../theme/templates/ArrayFieldTemplate.tsx | 71 ++++--------------- .../theme/widgets/ArrayAsTextWidget.tsx | 32 +++++++++ web/src/views/settings/GlobalConfigView.tsx | 54 ++++++++++++-- 6 files changed, 105 insertions(+), 63 deletions(-) create mode 100644 web/src/components/config-form/theme/widgets/ArrayAsTextWidget.tsx diff --git a/web/public/locales/en/views/settings.json b/web/public/locales/en/views/settings.json index 17ffa8aac..d03b5f2b3 100644 --- a/web/public/locales/en/views/settings.json +++ b/web/public/locales/en/views/settings.json @@ -1123,6 +1123,14 @@ } }, "configForm": { + "global": { + "title": "Global Settings", + "description": "These settings apply to all cameras unless overridden in the camera-specific settings." + }, + "camera": { + "title": "Camera Settings", + "description": "These settings apply only to this camera and override the global settings." + }, "showAdvanced": "Show Advanced Settings", "tabs": { "sharedDefaults": "Shared Defaults", diff --git a/web/src/components/config-form/sections/ReviewSection.tsx b/web/src/components/config-form/sections/ReviewSection.tsx index ae1000c50..301830aef 100644 --- a/web/src/components/config-form/sections/ReviewSection.tsx +++ b/web/src/components/config-form/sections/ReviewSection.tsx @@ -17,6 +17,7 @@ export const ReviewSection = createConfigSection({ "detections.labels", "detections.enabled_in_config", "detections.required_zones", + "genai.enabled_in_config", ], advancedFields: [], }, diff --git a/web/src/components/config-form/theme/frigateTheme.ts b/web/src/components/config-form/theme/frigateTheme.ts index ddf74f45a..a9691039c 100644 --- a/web/src/components/config-form/theme/frigateTheme.ts +++ b/web/src/components/config-form/theme/frigateTheme.ts @@ -22,6 +22,7 @@ import { SwitchesWidget } from "./widgets/SwitchesWidget"; import { ObjectLabelSwitchesWidget } from "./widgets/ObjectLabelSwitchesWidget"; import { AudioLabelSwitchesWidget } from "./widgets/AudioLabelSwitchesWidget"; import { ZoneSwitchesWidget } from "./widgets/ZoneSwitchesWidget"; +import { ArrayAsTextWidget } from "./widgets/ArrayAsTextWidget"; import { FieldTemplate } from "./templates/FieldTemplate"; import { ObjectFieldTemplate } from "./templates/ObjectFieldTemplate"; @@ -48,6 +49,7 @@ export const frigateTheme: FrigateTheme = { PasswordWidget: PasswordWidget, SelectWidget: SelectWidget, CheckboxWidget: SwitchWidget, + ArrayAsTextWidget: ArrayAsTextWidget, // Custom widgets switch: SwitchWidget, password: PasswordWidget, diff --git a/web/src/components/config-form/theme/templates/ArrayFieldTemplate.tsx b/web/src/components/config-form/theme/templates/ArrayFieldTemplate.tsx index c43afc88e..8b40f9349 100644 --- a/web/src/components/config-form/theme/templates/ArrayFieldTemplate.tsx +++ b/web/src/components/config-form/theme/templates/ArrayFieldTemplate.tsx @@ -1,19 +1,10 @@ // Array Field Template - renders array fields with add/remove controls import type { ArrayFieldTemplateProps } from "@rjsf/utils"; import { Button } from "@/components/ui/button"; -import { Card, CardContent } from "@/components/ui/card"; -import { LuPlus, LuTrash2, LuGripVertical } from "react-icons/lu"; +import { LuPlus } from "react-icons/lu"; import { useTranslation } from "react-i18next"; import { cn } from "@/lib/utils"; -interface ArrayItem { - key: string; - index: number; - children: React.ReactNode; - hasRemove: boolean; - onDropIndexClick: (index: number) => () => void; -} - export function ArrayFieldTemplate(props: ArrayFieldTemplateProps) { const { items, canAdd, onAddClick, disabled, readonly, schema } = props; @@ -36,52 +27,20 @@ export function ArrayFieldTemplate(props: ArrayFieldTemplateProps) {
)} - {(items as unknown as ArrayItem[]).map((element: ArrayItem) => ( -