grafana/public/app/plugins/panel/alertGroups/module.tsx
Nathan Rodman b153bb6101
Alerting: Add alertmanager notifications panel (#37078)
* Add filter parsing to rule list filters

* Add unit tests for label parsing

* Make label operators an enum

* add example for parsing function

* Update labels operator regex

* Use tooltip for query syntax example

* refactor to use Matchers for filtering

* wip: initial alertmanager notifications panel

* Panel for alertmanager notificaitons

* add filtering for notifications list

* remove icon

* rename am notifications to alert groups

* naming fixes

* Feature toggle

* Add toggle for expand all

* add pluralize

* add action buttons

* test work in progress

* Tests for alert groups panel

* Add useEffect for expandAll prop change

* Set panel to alpha state

* Fix colors

* fix polling interval callback

Co-authored-by: Domas <domas.lapinskas@grafana.com>

Co-authored-by: Domas <domas.lapinskas@grafana.com>
2021-08-17 15:02:03 -07:00

40 lines
1.3 KiB
TypeScript

import React from 'react';
import { PanelPlugin } from '@grafana/data';
import { AlertGroupPanelOptions } from './types';
import { AlertGroupsPanel } from './AlertGroupsPanel';
import { AlertManagerPicker } from 'app/features/alerting/unified/components/AlertManagerPicker';
import { GRAFANA_RULES_SOURCE_NAME } from 'app/features/alerting/unified/utils/datasource';
export const plugin = new PanelPlugin<AlertGroupPanelOptions>(AlertGroupsPanel).setPanelOptions((builder) => {
return builder
.addCustomEditor({
name: 'Alertmanager',
path: 'alertmanager',
id: 'alertmanager',
defaultValue: GRAFANA_RULES_SOURCE_NAME,
category: ['Options'],
editor: function RenderAlertmanagerPicker(props) {
return (
<AlertManagerPicker
current={props.value}
onChange={(alertManagerSourceName) => {
return props.onChange(alertManagerSourceName);
}}
/>
);
},
})
.addBooleanSwitch({
name: 'Expand all by default',
path: 'expandAll',
defaultValue: false,
category: ['Options'],
})
.addTextInput({
description: 'Filter results by matching labels, ex: env=production,severity=~critical|warning',
name: 'Labels',
path: 'labels',
category: ['Filter'],
});
});