grafana/public/app/plugins/panel/debug/module.tsx
Jack Westbrook 5815a37f47
Debug Panel: Introduce schema types (#62094)
* feat(debugpanel): schematizing debug panel plugin

* delete old types and update imports to new generated schema

* update to experimental

* derived counters, fix options key name

* num to int

* chore(debugpanel): update ts imports post type rename

* chore(kindsys): refresh report.json

* migrate UpdateCounters back to runtime

* merge with main

---------

Co-authored-by: Will Browne <will.browne@grafana.com>
Co-authored-by: sam boyer <sdboyer@grafana.com>
2023-02-03 11:57:04 +01:00

59 lines
1.7 KiB
TypeScript

import { PanelPlugin } from '@grafana/data';
import { DebugPanel } from './DebugPanel';
import { StateViewEditor } from './StateView';
import { DebugMode, PanelOptions } from './panelcfg.gen';
export const plugin = new PanelPlugin<PanelOptions>(DebugPanel).useFieldConfig().setPanelOptions((builder) => {
builder
.addSelect({
path: 'mode',
name: 'Mode',
defaultValue: DebugMode.Render,
settings: {
options: [
{ label: 'Render', value: DebugMode.Render },
{ label: 'Events', value: DebugMode.Events },
{ label: 'Cursor', value: DebugMode.Cursor },
{ label: 'Cursor', value: DebugMode.Cursor },
{ label: 'Share state', value: DebugMode.State },
{ label: 'Throw error', value: DebugMode.ThrowError },
],
},
})
.addCustomEditor({
id: 'stateView',
path: 'stateView',
name: 'State view',
defaultValue: '',
showIf: ({ mode }) => mode === DebugMode.State,
editor: StateViewEditor,
})
.addBooleanSwitch({
path: 'counters.render',
name: 'Render Count',
defaultValue: true,
showIf: ({ mode }) => mode === DebugMode.Render,
})
.addBooleanSwitch({
path: 'counters.dataChanged',
name: 'Data Changed Count',
defaultValue: true,
showIf: ({ mode }) => mode === DebugMode.Render,
})
.addBooleanSwitch({
path: 'counters.schemaChanged',
name: 'Schema Changed Count',
defaultValue: true,
showIf: ({ mode }) => mode === DebugMode.Render,
})
.addDashboardPicker({
path: 'dashboardUID',
name: 'Dashboard',
settings: {
placeholder: 'Select dashboard',
isClearable: true,
},
});
});