Alerting: Fix folder picker clear action (#56864)

This commit is contained in:
Konrad Lalik
2022-10-14 08:48:05 +02:00
committed by GitHub
parent 527690d19a
commit 9d0380cbdd
3 changed files with 5 additions and 5 deletions
+1
View File
@@ -61,6 +61,7 @@ public/css/*.min.css
*.sublime-workspace *.sublime-workspace
*.swp *.swp
.idea/ .idea/
.fleet/
*.iml *.iml
*.tmp *.tmp
.DS_Store .DS_Store
@@ -193,9 +193,8 @@ export function FolderPicker(props: Props) {
}, [folder]); }, [folder]);
const onFolderChange = useCallback( const onFolderChange = useCallback(
(newFolder: SelectableValue<number>, actionMeta: ActionMeta) => { (newFolder: SelectableValue<number> | null | undefined, actionMeta: ActionMeta) => {
const value = newFolder.value; if (newFolder?.value === VALUE_FOR_ADD) {
if (value === VALUE_FOR_ADD) {
setFolder({ setFolder({
id: VALUE_FOR_ADD, id: VALUE_FOR_ADD,
title: inputValue, title: inputValue,
@@ -246,7 +246,7 @@ const unifiedAlertList = new PanelPlugin<UnifiedAlertListOptions>(UnifiedAlertLi
.addCustomEditor({ .addCustomEditor({
path: 'folder', path: 'folder',
name: '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', id: 'folder',
defaultValue: null, defaultValue: null,
editor: function RenderFolderPicker(props) { editor: function RenderFolderPicker(props) {
@@ -279,7 +279,7 @@ const unifiedAlertList = new PanelPlugin<UnifiedAlertListOptions>(UnifiedAlertLi
noDefault noDefault
current={props.value} current={props.value}
onChange={(ds) => props.onChange(ds.name)} onChange={(ds) => props.onChange(ds.name)}
onClear={() => props.onChange('')} onClear={() => props.onChange(null)}
/> />
); );
}, },