mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Add new scenes for grafana managed alerts * Remove unused import * Fix lint * Remove width property from SceneFlexItem * Add missing scenes for GMA section * Improve scenes layout * Add Grafana Alertmanager panels * Fix lint * Fix lint * Refactor expression variables * Apply shared styles to scenes
30 lines
875 B
TypeScript
30 lines
875 B
TypeScript
import { PanelBuilders, SceneFlexItem, SceneQueryRunner, SceneTimeRange } from '@grafana/scenes';
|
|
import { DataSourceRef, GraphDrawStyle } from '@grafana/schema';
|
|
|
|
import { PANEL_STYLES } from '../../home/Insights';
|
|
|
|
export function getInvalidConfigScene(timeRange: SceneTimeRange, datasource: DataSourceRef, panelTitle: string) {
|
|
const query = new SceneQueryRunner({
|
|
datasource,
|
|
queries: [
|
|
{
|
|
refId: 'A',
|
|
expr: 'sum by (cluster)(grafanacloud_instance_alertmanager_invalid_config)',
|
|
range: true,
|
|
legendFormat: '{{cluster}}',
|
|
},
|
|
],
|
|
$timeRange: timeRange,
|
|
});
|
|
|
|
return new SceneFlexItem({
|
|
...PANEL_STYLES,
|
|
body: PanelBuilders.timeseries()
|
|
.setTitle(panelTitle)
|
|
.setData(query)
|
|
.setCustomFieldConfig('drawStyle', GraphDrawStyle.Line)
|
|
.setUnit('bool_yes_no')
|
|
.build(),
|
|
});
|
|
}
|