From 580332a8937457e9194c4227503659c66bbff09d Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Fri, 27 Mar 2026 09:35:13 -0500 Subject: [PATCH] add hint for empty selection in review labels and SwitchesWidget --- web/public/locales/en/views/settings.json | 3 ++- .../config-form/section-configs/review.ts | 2 ++ .../config-form/theme/widgets/SwitchesWidget.tsx | 15 ++++++++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/web/public/locales/en/views/settings.json b/web/public/locales/en/views/settings.json index f32244cb4..4c8ee0a8a 100644 --- a/web/public/locales/en/views/settings.json +++ b/web/public/locales/en/views/settings.json @@ -1433,7 +1433,8 @@ }, "reviewLabels": { "summary": "{{count}} labels selected", - "empty": "No labels available" + "empty": "No labels available", + "allNonAlertDetections": "All non-alert activity will be included as detections." }, "filters": { "objectFieldLabel": "{{field}} for {{label}}" diff --git a/web/src/components/config-form/section-configs/review.ts b/web/src/components/config-form/section-configs/review.ts index d7fb955e4..c52bd9add 100644 --- a/web/src/components/config-form/section-configs/review.ts +++ b/web/src/components/config-form/section-configs/review.ts @@ -35,6 +35,8 @@ const review: SectionConfigOverrides = { "ui:widget": "reviewLabels", "ui:options": { suppressMultiSchema: true, + emptySelectionHintKey: + "configForm.reviewLabels.allNonAlertDetections", }, }, required_zones: { diff --git a/web/src/components/config-form/theme/widgets/SwitchesWidget.tsx b/web/src/components/config-form/theme/widgets/SwitchesWidget.tsx index c4b324d6c..a7351c8b7 100644 --- a/web/src/components/config-form/theme/widgets/SwitchesWidget.tsx +++ b/web/src/components/config-form/theme/widgets/SwitchesWidget.tsx @@ -45,6 +45,8 @@ export type SwitchesWidgetOptions = { enableSearch?: boolean; /** Allow users to add custom entries not in the predefined list */ allowCustomEntries?: boolean; + /** i18n key for a hint shown when no entities are selected */ + emptySelectionHintKey?: string; }; function normalizeValue(value: unknown): string[] { @@ -129,6 +131,11 @@ export function SwitchesWidget(props: WidgetProps) { [props.options], ); + const emptySelectionHintKey = useMemo( + () => props.options?.emptySelectionHintKey as string | undefined, + [props.options], + ); + const selectedEntities = useMemo(() => normalizeValue(value), [value]); const [isOpen, setIsOpen] = useState(selectedEntities.length > 0); const [searchTerm, setSearchTerm] = useState(""); @@ -191,7 +198,7 @@ export function SwitchesWidget(props: WidgetProps) { return ( -
+