2021-04-06 18:06:46 -05:00
|
|
|
import { FieldColorModeId, FieldConfigProperty, PanelPlugin } from '@grafana/data';
|
2021-09-20 12:25:56 -07:00
|
|
|
import { VisibilityMode } from '@grafana/schema';
|
2021-08-24 08:22:34 -07:00
|
|
|
import { commonOptionsBuilder } from '@grafana/ui';
|
2022-04-22 14:33:13 +01:00
|
|
|
|
|
|
|
|
import { StatusHistoryPanel } from './StatusHistoryPanel';
|
2023-01-26 09:03:59 +02:00
|
|
|
import { PanelOptions, PanelFieldConfig, defaultPanelFieldConfig } from './panelcfg.gen';
|
2021-11-11 14:10:23 +01:00
|
|
|
import { StatusHistorySuggestionsSupplier } from './suggestions';
|
2021-04-06 18:06:46 -05:00
|
|
|
|
2023-01-26 09:03:59 +02:00
|
|
|
export const plugin = new PanelPlugin<PanelOptions, PanelFieldConfig>(StatusHistoryPanel)
|
2021-04-06 18:06:46 -05:00
|
|
|
.useFieldConfig({
|
|
|
|
|
standardOptions: {
|
|
|
|
|
[FieldConfigProperty.Color]: {
|
|
|
|
|
settings: {
|
|
|
|
|
byValueSupport: true,
|
|
|
|
|
},
|
|
|
|
|
defaultValue: {
|
2021-05-19 23:38:31 -05:00
|
|
|
mode: FieldColorModeId.Thresholds,
|
2021-04-06 18:06:46 -05:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
useCustomConfig: (builder) => {
|
|
|
|
|
builder
|
|
|
|
|
.addSliderInput({
|
|
|
|
|
path: 'lineWidth',
|
|
|
|
|
name: 'Line width',
|
2023-01-26 09:03:59 +02:00
|
|
|
defaultValue: defaultPanelFieldConfig.lineWidth,
|
2021-04-06 18:06:46 -05:00
|
|
|
settings: {
|
|
|
|
|
min: 0,
|
|
|
|
|
max: 10,
|
|
|
|
|
step: 1,
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
.addSliderInput({
|
|
|
|
|
path: 'fillOpacity',
|
|
|
|
|
name: 'Fill opacity',
|
2023-01-26 09:03:59 +02:00
|
|
|
defaultValue: defaultPanelFieldConfig.fillOpacity,
|
2021-04-06 18:06:46 -05:00
|
|
|
settings: {
|
|
|
|
|
min: 0,
|
|
|
|
|
max: 100,
|
|
|
|
|
step: 1,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
.setPanelOptions((builder) => {
|
|
|
|
|
builder
|
|
|
|
|
.addRadio({
|
|
|
|
|
path: 'showValue',
|
|
|
|
|
name: 'Show values',
|
|
|
|
|
settings: {
|
|
|
|
|
options: [
|
2021-09-20 12:25:56 -07:00
|
|
|
{ value: VisibilityMode.Auto, label: 'Auto' },
|
|
|
|
|
{ value: VisibilityMode.Always, label: 'Always' },
|
|
|
|
|
{ value: VisibilityMode.Never, label: 'Never' },
|
2021-04-06 18:06:46 -05:00
|
|
|
],
|
|
|
|
|
},
|
2021-09-20 12:25:56 -07:00
|
|
|
defaultValue: VisibilityMode.Auto,
|
2021-04-06 18:06:46 -05:00
|
|
|
})
|
2023-01-27 12:52:32 +02:00
|
|
|
.addSliderInput({
|
|
|
|
|
path: 'rowHeight',
|
|
|
|
|
name: 'Row height',
|
|
|
|
|
defaultValue: 0.9,
|
|
|
|
|
settings: {
|
|
|
|
|
min: 0,
|
|
|
|
|
max: 1,
|
|
|
|
|
step: 0.01,
|
|
|
|
|
},
|
|
|
|
|
})
|
2021-04-06 18:06:46 -05:00
|
|
|
.addSliderInput({
|
|
|
|
|
path: 'colWidth',
|
|
|
|
|
name: 'Column width',
|
|
|
|
|
defaultValue: 0.9,
|
|
|
|
|
settings: {
|
|
|
|
|
min: 0,
|
|
|
|
|
max: 1,
|
|
|
|
|
step: 0.01,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
2021-06-03 04:43:47 +02:00
|
|
|
commonOptionsBuilder.addLegendOptions(builder, false);
|
|
|
|
|
commonOptionsBuilder.addTooltipOptions(builder, true);
|
2021-11-11 14:10:23 +01:00
|
|
|
})
|
|
|
|
|
.setSuggestionsSupplier(new StatusHistorySuggestionsSupplier());
|