From 9d0380cbdd8d58df5f6fb7534812f04a489b7cfa Mon Sep 17 00:00:00 2001 From: Konrad Lalik Date: Fri, 14 Oct 2022 08:48:05 +0200 Subject: [PATCH] Alerting: Fix folder picker clear action (#56864) --- .gitignore | 1 + public/app/core/components/Select/FolderPicker.tsx | 5 ++--- public/app/plugins/panel/alertlist/module.tsx | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 053ceecf64f..1d598a8d73f 100644 --- a/.gitignore +++ b/.gitignore @@ -61,6 +61,7 @@ public/css/*.min.css *.sublime-workspace *.swp .idea/ +.fleet/ *.iml *.tmp .DS_Store diff --git a/public/app/core/components/Select/FolderPicker.tsx b/public/app/core/components/Select/FolderPicker.tsx index 27843c3283a..bd428af9c1f 100644 --- a/public/app/core/components/Select/FolderPicker.tsx +++ b/public/app/core/components/Select/FolderPicker.tsx @@ -193,9 +193,8 @@ export function FolderPicker(props: Props) { }, [folder]); const onFolderChange = useCallback( - (newFolder: SelectableValue, actionMeta: ActionMeta) => { - const value = newFolder.value; - if (value === VALUE_FOR_ADD) { + (newFolder: SelectableValue | null | undefined, actionMeta: ActionMeta) => { + if (newFolder?.value === VALUE_FOR_ADD) { setFolder({ id: VALUE_FOR_ADD, title: inputValue, diff --git a/public/app/plugins/panel/alertlist/module.tsx b/public/app/plugins/panel/alertlist/module.tsx index 84d8cbb36e8..f24992a25a7 100644 --- a/public/app/plugins/panel/alertlist/module.tsx +++ b/public/app/plugins/panel/alertlist/module.tsx @@ -246,7 +246,7 @@ const unifiedAlertList = new PanelPlugin(UnifiedAlertLi .addCustomEditor({ path: 'folder', name: 'Folder', - description: 'Filter for alerts in the selected folder', + description: 'Filter for alerts in the selected folder (only for Grafana alerts)', id: 'folder', defaultValue: null, editor: function RenderFolderPicker(props) { @@ -279,7 +279,7 @@ const unifiedAlertList = new PanelPlugin(UnifiedAlertLi noDefault current={props.value} onChange={(ds) => props.onChange(ds.name)} - onClear={() => props.onChange('')} + onClear={() => props.onChange(null)} /> ); },