This commit is contained in:
Josh Hawkins
2026-02-27 09:40:21 -06:00
parent 5f262621c4
commit edc980ab8b
7 changed files with 41 additions and 9 deletions
@@ -4,6 +4,12 @@ const detectors: SectionConfigOverrides = {
base: {
fieldOrder: [],
advancedFields: [],
hiddenFields: [
"*.model.labelmap",
"*.model.attributes_map",
"*.model",
"*.model_path",
],
},
};
@@ -7,6 +7,9 @@ const live: SectionConfigOverrides = {
hiddenFields: ["enabled_in_config"],
advancedFields: ["quality"],
},
global: {
hiddenFields: ["streams"],
},
};
export default live;
@@ -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;
@@ -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 | number>): 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 | number>): 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")
@@ -63,7 +63,7 @@ export function WrapIfAdditionalTemplate<
className={cn("grid grid-cols-12 items-start gap-2", classNames)}
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>}
<Input
id={keyId}
@@ -75,11 +75,11 @@ export function WrapIfAdditionalTemplate<
onBlur={!readonly ? onKeyRenameBlur : undefined}
/>
</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>}
<div className="min-w-0">{children}</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
type="button"
variant="ghost"