Import
Constructors
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
angularPanelCtrl | any | Legacy angular ctrl. If this exists it will be used instead of the panel | |
PanelPluginDataSupport | |||
defaults | {} | null | ||
ComponentClass<PanelEditorProps<TOptions>> | |||
fieldConfigDefaults | FieldConfigSource<TFieldConfigOptions> | ||
FieldConfigOptionsRegistry | |||
noPadding | boolean | ||
PanelMigrationHandler<TOptions> | |||
onPanelTypeChanged | PanelTypeChangedHandler<TOptions> | ||
PanelOptionEditorsRegistry | |||
panel | ComponentType<PanelProps<TOptions>> | null |
Methods
Method | Modifiers | Description |
---|---|---|
Tells Grafana if the plugin should subscribe to annotation and alertState results. | ||
setDefaults(defaults) | ||
setMigrationHandler(handler) | This function is called before the panel first loads if the current version is different than the version that was saved.This is a good place to support any changes to the options model | |
setPanelChangeHandler(handler) | This function is called when the visualization was changed. This passes in the panel model for previous visualisation options inspection and panel model updates.This is useful for supporting PanelModel API updates when changing between Angular and React panels. | |
Enables panel options editor creation | ||
useFieldConfig(config) | Allows specifying which standard field config options panel should use and defining default values |
Constructs a new instance of the PanelPlugin
class
Signature
Parameters
angularPanelCtrl property
Legacy angular ctrl. If this exists it will be used instead of the panel
Signature
angularPanelCtrl?: any;
dataSupport property
Signature
dataSupport: PanelPluginDataSupport;
defaults property
Signature
get defaults(): {} | null;
editor property
Signature
editor?: ComponentClass<PanelEditorProps<TOptions>>;
fieldConfigDefaults property
Signature
get fieldConfigDefaults(): FieldConfigSource<TFieldConfigOptions>;
Signature
noPadding property
Signature
noPadding?: boolean;
onPanelMigration property
Signature
onPanelMigration?: PanelMigrationHandler<TOptions>;
onPanelTypeChanged property
Signature
onPanelTypeChanged?: PanelTypeChangedHandler<TOptions>;
optionEditors property
Signature
get optionEditors(): PanelOptionEditorsRegistry;
panel property
panel: ComponentType<PanelProps<TOptions>> | null;
Tells Grafana if the plugin should subscribe to annotation and alertState results.
Signature
setDataSupport(support: Partial<PanelPluginDataSupport>): this;
Parameters
Parameter | Type | Description |
---|---|---|
support |
Returns:
this
import { ShapePanel } from './ShapePanel';
interface ShapePanelOptions {}
export const plugin = new PanelPlugin<ShapePanelOptions>(ShapePanel)
.useFieldConfig({})
...
...
.setDataSupport({
annotations: true,
alertStates: true,
});
setDefaults method
Signature
Parameters
Parameter | Type | Description |
---|---|---|
defaults | TOptions |
Returns:
this
setEditor method
Signature
Parameters
Returns:
this
setMigrationHandler method
This function is called before the panel first loads if the current version is different than the version that was saved.
This is a good place to support any changes to the options model
Signature
setMigrationHandler(handler: PanelMigrationHandler<TOptions>): this;
Parameters
Parameter | Type | Description |
---|---|---|
handler | PanelMigrationHandler<TOptions> |
Returns:
setNoPadding method
Signature
setNoPadding(): this;
Returns:
this
setPanelChangeHandler method
This function is called when the visualization was changed. This passes in the panel model for previous visualisation options inspection and panel model updates.
This is useful for supporting PanelModel API updates when changing between Angular and React panels.
Signature
setPanelChangeHandler(handler: PanelTypeChangedHandler): this;
Parameters
Parameter | Type | Description |
---|---|---|
handler | PanelTypeChangedHandler |
Returns:
Enables panel options editor creation
Signature
setPanelOptions(builder: (builder: PanelOptionsEditorBuilder<TOptions>) => void): this;
Parameters
Returns:
this
import { ShapePanel } from './ShapePanel';
interface ShapePanelOptions {}
export const plugin = new PanelPlugin<ShapePanelOptions>(ShapePanel)
.setPanelOptions(builder => {
builder
.addSelect({
id: 'shape',
name: 'Shape',
description: 'Select shape to render'
settings: {
options: [
{value: 'circle', label: 'Circle' },
{value: 'square', label: 'Square },
{value: 'triangle', label: 'Triangle }
]
},
})
useFieldConfig method
Allows specifying which standard field config options panel should use and defining default values
Signature
useFieldConfig(config?: SetFieldConfigOptionsArgs<TFieldConfigOptions>): this;
Parameters
Parameter | Type | Description |
---|---|---|
config | SetFieldConfigOptionsArgs<TFieldConfigOptions> |
Returns: