Alerting: Make folder filter clearable in Alert list panel (#50093)

This commit is contained in:
Peter Holmberg
2022-06-03 15:43:29 +02:00
committed by GitHub
parent e6ceee501f
commit b1e1a97c63
2 changed files with 28 additions and 13 deletions

View File

@@ -3,13 +3,13 @@ import React from 'react';
import { PanelPlugin } from '@grafana/data';
import { config, DataSourcePicker } from '@grafana/runtime';
import { TagsInput } from '@grafana/ui';
import { RuleFolderPicker } from 'app/features/alerting/unified/components/rule-editor/RuleFolderPicker';
import { FolderPicker } from 'app/core/components/Select/FolderPicker';
import {
ALL_FOLDER,
GENERAL_FOLDER,
ReadonlyFolderPicker,
} from '../../../core/components/Select/ReadonlyFolderPicker/ReadonlyFolderPicker';
} from 'app/core/components/Select/ReadonlyFolderPicker/ReadonlyFolderPicker';
import { PermissionLevelString } from 'app/types';
import { AlertList } from './AlertList';
import { alertListPanelMigrationHandler } from './AlertListMigrationHandler';
@@ -238,12 +238,15 @@ const unifiedAlertList = new PanelPlugin<UnifiedAlertListOptions>(UnifiedAlertLi
defaultValue: null,
editor: function RenderFolderPicker(props) {
return (
<RuleFolderPicker
{...props}
<FolderPicker
enableReset={true}
onChange={({ title, id }) => {
return props.onChange({ title, id });
}}
showRoot={false}
allowEmpty={true}
initialTitle={props.value?.title}
initialFolderId={props.value?.id}
permissionLevel={PermissionLevelString.View}
onClear={() => props.onChange('')}
{...props}
/>
);
},