[v9.2.x] Alerting: Fix folder picker clear action (#56915)

Co-authored-by: Konrad Lalik <konrad.lalik@grafana.com>
This commit is contained in:
Grot (@grafanabot)
2022-10-14 09:16:28 +02:00
committed by GitHub
co-authored by Konrad Lalik
parent 61f0183275
commit 53c71b486a
3 changed files with 5 additions and 5 deletions
+1
View File
@@ -61,6 +61,7 @@ public/css/*.min.css
*.sublime-workspace
*.swp
.idea/
.fleet/
*.iml
*.tmp
.DS_Store
@@ -193,9 +193,8 @@ export function FolderPicker(props: Props) {
}, [folder]);
const onFolderChange = useCallback(
(newFolder: SelectableValue<number>, actionMeta: ActionMeta) => {
const value = newFolder.value;
if (value === VALUE_FOR_ADD) {
(newFolder: SelectableValue<number> | null | undefined, actionMeta: ActionMeta) => {
if (newFolder?.value === VALUE_FOR_ADD) {
setFolder({
id: VALUE_FOR_ADD,
title: inputValue,
@@ -246,7 +246,7 @@ const unifiedAlertList = new PanelPlugin<UnifiedAlertListOptions>(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<UnifiedAlertListOptions>(UnifiedAlertLi
noDefault
current={props.value}
onChange={(ds) => props.onChange(ds.name)}
onClear={() => props.onChange('')}
onClear={() => props.onChange(null)}
/>
);
},