2021-03-22 22:38:24 -05:00
|
|
|
import { PanelPlugin } from '@grafana/data';
|
2022-04-22 08:33:13 -05:00
|
|
|
|
2021-03-22 22:38:24 -05:00
|
|
|
import { DebugPanel } from './DebugPanel';
|
2021-10-01 04:08:11 -05:00
|
|
|
import { StateViewEditor } from './StateView';
|
2021-04-26 09:13:15 -05:00
|
|
|
import { DebugMode, DebugPanelOptions } from './types';
|
2021-03-22 22:38:24 -05:00
|
|
|
|
|
|
|
export const plugin = new PanelPlugin<DebugPanelOptions>(DebugPanel).useFieldConfig().setPanelOptions((builder) => {
|
|
|
|
builder
|
2021-10-22 04:52:05 -05:00
|
|
|
.addSelect({
|
2021-04-26 09:13:15 -05:00
|
|
|
path: 'mode',
|
|
|
|
name: 'Mode',
|
|
|
|
defaultValue: DebugMode.Render,
|
|
|
|
settings: {
|
|
|
|
options: [
|
|
|
|
{ label: 'Render', value: DebugMode.Render },
|
|
|
|
{ label: 'Events', value: DebugMode.Events },
|
2021-05-10 07:24:23 -05:00
|
|
|
{ label: 'Cursor', value: DebugMode.Cursor },
|
2021-10-22 04:52:05 -05:00
|
|
|
{ label: 'Cursor', value: DebugMode.Cursor },
|
2021-10-01 04:08:11 -05:00
|
|
|
{ label: 'Share state', value: DebugMode.State },
|
2021-10-22 04:52:05 -05:00
|
|
|
{ label: 'Throw error', value: DebugMode.ThrowError },
|
2021-04-26 09:13:15 -05:00
|
|
|
],
|
|
|
|
},
|
|
|
|
})
|
2021-10-01 04:08:11 -05:00
|
|
|
.addCustomEditor({
|
|
|
|
id: 'stateView',
|
|
|
|
path: 'stateView',
|
|
|
|
name: 'State view',
|
|
|
|
defaultValue: '',
|
|
|
|
showIf: ({ mode }) => mode === DebugMode.State,
|
|
|
|
editor: StateViewEditor,
|
|
|
|
})
|
2021-03-22 22:38:24 -05:00
|
|
|
.addBooleanSwitch({
|
|
|
|
path: 'counters.render',
|
|
|
|
name: 'Render Count',
|
|
|
|
defaultValue: true,
|
2021-04-26 09:13:15 -05:00
|
|
|
showIf: ({ mode }) => mode === DebugMode.Render,
|
2021-03-22 22:38:24 -05:00
|
|
|
})
|
|
|
|
.addBooleanSwitch({
|
|
|
|
path: 'counters.dataChanged',
|
|
|
|
name: 'Data Changed Count',
|
|
|
|
defaultValue: true,
|
2021-04-26 09:13:15 -05:00
|
|
|
showIf: ({ mode }) => mode === DebugMode.Render,
|
2021-03-22 22:38:24 -05:00
|
|
|
})
|
|
|
|
.addBooleanSwitch({
|
|
|
|
path: 'counters.schemaChanged',
|
|
|
|
name: 'Schema Changed Count',
|
|
|
|
defaultValue: true,
|
2021-04-26 09:13:15 -05:00
|
|
|
showIf: ({ mode }) => mode === DebugMode.Render,
|
2021-09-14 01:30:46 -05:00
|
|
|
})
|
|
|
|
.addDashboardPicker({
|
|
|
|
path: 'dashboardUID',
|
|
|
|
name: 'Dashboard',
|
|
|
|
settings: {
|
|
|
|
placeholder: 'Select dashboard',
|
|
|
|
isClearable: true,
|
|
|
|
},
|
2021-03-22 22:38:24 -05:00
|
|
|
});
|
|
|
|
});
|