mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
DashboardQueryRunner: Add dataSupport to PanelModel & PanelPlugin (#33253)
* DashboardQueryRunner: Add dataSupport to PanelModel & PanelPlugin Relates to #32834
This commit is contained in:
parent
dd9f701cd9
commit
57e9b11fda
@ -8,6 +8,7 @@ import {
|
||||
PanelProps,
|
||||
PanelTypeChangedHandler,
|
||||
FieldConfigProperty,
|
||||
PanelPluginDataSupport,
|
||||
} from '../types';
|
||||
import { FieldConfigEditorBuilder, PanelOptionsEditorBuilder } from '../utils/OptionsUIBuilders';
|
||||
import { ComponentClass, ComponentType } from 'react';
|
||||
@ -106,6 +107,10 @@ export class PanelPlugin<
|
||||
onPanelMigration?: PanelMigrationHandler<TOptions>;
|
||||
onPanelTypeChanged?: PanelTypeChangedHandler<TOptions>;
|
||||
noPadding?: boolean;
|
||||
dataSupport: PanelPluginDataSupport = {
|
||||
annotations: false,
|
||||
alertStates: false,
|
||||
};
|
||||
|
||||
/**
|
||||
* Legacy angular ctrl. If this exists it will be used instead of the panel
|
||||
@ -259,6 +264,33 @@ export class PanelPlugin<
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells Grafana if the plugin should subscribe to annotation and alertState results.
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
*
|
||||
* import { ShapePanel } from './ShapePanel';
|
||||
*
|
||||
* interface ShapePanelOptions {}
|
||||
*
|
||||
* export const plugin = new PanelPlugin<ShapePanelOptions>(ShapePanel)
|
||||
* .useFieldConfig({})
|
||||
* ...
|
||||
* ...
|
||||
* .setDataSupport({
|
||||
* annotations: true,
|
||||
* alertStates: true,
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @public
|
||||
**/
|
||||
setDataSupport(support: Partial<PanelPluginDataSupport>) {
|
||||
this.dataSupport = { ...this.dataSupport, ...support };
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows specifying which standard field config options panel should use and defining default values
|
||||
*
|
||||
|
@ -182,3 +182,8 @@ export enum VizOrientation {
|
||||
Vertical = 'vertical',
|
||||
Horizontal = 'horizontal',
|
||||
}
|
||||
|
||||
export interface PanelPluginDataSupport {
|
||||
annotations: boolean;
|
||||
alertStates: boolean;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user