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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

1
.gitignore vendored
View File

@ -61,6 +61,7 @@ public/css/*.min.css
*.sublime-workspace
*.swp
.idea/
.fleet/
*.iml
*.tmp
.DS_Store

View File

@ -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,

View File

@ -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)}
/>
);
},