2021-09-02 12:01:08 -05:00
|
|
|
import { PanelPlugin } from '@grafana/data';
|
|
|
|
|
2021-10-06 14:41:42 -05:00
|
|
|
import { CanvasPanel, InstanceState } from './CanvasPanel';
|
|
|
|
import { PanelOptions } from './models.gen';
|
|
|
|
import { getElementEditor } from './editor/elementEditor';
|
2021-09-02 12:01:08 -05:00
|
|
|
|
|
|
|
export const plugin = new PanelPlugin<PanelOptions>(CanvasPanel)
|
|
|
|
.setNoPadding() // extend to panel edges
|
|
|
|
.useFieldConfig()
|
2021-10-06 14:41:42 -05:00
|
|
|
.setPanelOptions((builder, context) => {
|
|
|
|
const state: InstanceState = context.instanceState;
|
|
|
|
|
|
|
|
builder.addBooleanSwitch({
|
|
|
|
path: 'inlineEditing',
|
|
|
|
name: 'Inline editing',
|
|
|
|
description: 'Enable editing while the panel is in dashboard mode',
|
|
|
|
defaultValue: true,
|
2021-09-02 12:01:08 -05:00
|
|
|
});
|
2021-10-06 14:41:42 -05:00
|
|
|
|
|
|
|
if (state?.selected) {
|
|
|
|
builder.addNestedOptions(
|
|
|
|
getElementEditor({
|
|
|
|
category: ['Selected element'],
|
|
|
|
element: state.selected,
|
|
|
|
scene: state.scene,
|
|
|
|
})
|
|
|
|
);
|
|
|
|
}
|
2021-09-02 12:01:08 -05:00
|
|
|
});
|