mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Render folder selector in options for Alert List Panel only when having Grafana datasource (#70816)
Render folder selector in options for Alert List Panel only when no datasource is selected or when Grafana is selected as the datasource
This commit is contained in:
parent
1206cf3dfa
commit
519e840f97
@ -11,6 +11,8 @@ import {
|
||||
} from 'app/core/components/Select/ReadonlyFolderPicker/ReadonlyFolderPicker';
|
||||
import { PermissionLevelString } from 'app/types';
|
||||
|
||||
import { GRAFANA_DATASOURCE_NAME } from '../../../features/alerting/unified/utils/datasource';
|
||||
|
||||
import { AlertList } from './AlertList';
|
||||
import { alertListPanelMigrationHandler } from './AlertListMigrationHandler';
|
||||
import { GroupBy } from './GroupByWithLoading';
|
||||
@ -244,6 +246,27 @@ const unifiedAlertList = new PanelPlugin<UnifiedAlertListOptions>(UnifiedAlertLi
|
||||
category: ['Filter'],
|
||||
})
|
||||
.addCustomEditor({
|
||||
path: 'datasource',
|
||||
name: 'Datasource',
|
||||
description: 'Filter alerts from selected datasource',
|
||||
id: 'datasource',
|
||||
defaultValue: null,
|
||||
editor: function RenderDatasourcePicker(props) {
|
||||
return (
|
||||
<DataSourcePicker
|
||||
{...props}
|
||||
type={['prometheus', 'loki', 'grafana']}
|
||||
noDefault
|
||||
current={props.value}
|
||||
onChange={(ds) => props.onChange(ds.name)}
|
||||
onClear={() => props.onChange(null)}
|
||||
/>
|
||||
);
|
||||
},
|
||||
category: ['Filter'],
|
||||
})
|
||||
.addCustomEditor({
|
||||
showIf: (options) => options.datasource === GRAFANA_DATASOURCE_NAME || !Boolean(options.datasource),
|
||||
path: 'folder',
|
||||
name: 'Folder',
|
||||
description: 'Filter for alerts in the selected folder (only for Grafana alerts)',
|
||||
@ -265,26 +288,6 @@ const unifiedAlertList = new PanelPlugin<UnifiedAlertListOptions>(UnifiedAlertLi
|
||||
},
|
||||
category: ['Filter'],
|
||||
})
|
||||
.addCustomEditor({
|
||||
path: 'datasource',
|
||||
name: 'Datasource',
|
||||
description: 'Filter alerts from selected datasource',
|
||||
id: 'datasource',
|
||||
defaultValue: null,
|
||||
editor: function RenderDatasourcePicker(props) {
|
||||
return (
|
||||
<DataSourcePicker
|
||||
{...props}
|
||||
type={['prometheus', 'loki', 'grafana']}
|
||||
noDefault
|
||||
current={props.value}
|
||||
onChange={(ds) => props.onChange(ds.name)}
|
||||
onClear={() => props.onChange(null)}
|
||||
/>
|
||||
);
|
||||
},
|
||||
category: ['Filter'],
|
||||
})
|
||||
.addBooleanSwitch({
|
||||
path: 'stateFilter.firing',
|
||||
name: 'Alerting / Firing',
|
||||
|
Loading…
Reference in New Issue
Block a user