2020-04-02 06:24:50 -05:00
|
|
|
import { PanelPlugin } from '@grafana/data';
|
2022-04-22 08:33:13 -05:00
|
|
|
import { commonOptionsBuilder } from '@grafana/ui';
|
|
|
|
|
2022-05-25 06:07:32 -05:00
|
|
|
import { addOrientationOption, addStandardDataReduceOptions } from '../stat/common';
|
2022-04-22 08:33:13 -05:00
|
|
|
|
2019-08-18 17:01:07 -05:00
|
|
|
import { gaugePanelMigrationHandler, gaugePanelChangedHandler } from './GaugeMigrations';
|
2022-04-22 08:33:13 -05:00
|
|
|
import { GaugePanel } from './GaugePanel';
|
2023-01-23 12:03:44 -06:00
|
|
|
import { PanelOptions, defaultPanelOptions } from './panelcfg.gen';
|
2021-10-25 06:55:06 -05:00
|
|
|
import { GaugeSuggestionsSupplier } from './suggestions';
|
2019-02-18 04:41:14 -06:00
|
|
|
|
2022-05-25 08:18:21 -05:00
|
|
|
export const plugin = new PanelPlugin<PanelOptions>(GaugePanel)
|
2022-11-18 05:13:31 -06:00
|
|
|
.useFieldConfig({
|
|
|
|
useCustomConfig: (builder) => {
|
|
|
|
builder.addNumberInput({
|
|
|
|
path: 'neutral',
|
|
|
|
name: 'Neutral',
|
|
|
|
description: 'Leave empty to use Min as neutral point',
|
|
|
|
category: ['Gauge'],
|
|
|
|
settings: {
|
|
|
|
placeholder: 'auto',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
})
|
2021-01-20 00:59:48 -06:00
|
|
|
.setPanelOptions((builder) => {
|
2021-03-25 02:33:13 -05:00
|
|
|
addStandardDataReduceOptions(builder);
|
2021-09-28 01:21:46 -05:00
|
|
|
addOrientationOption(builder);
|
2020-03-28 17:11:50 -05:00
|
|
|
builder
|
|
|
|
.addBooleanSwitch({
|
2020-04-06 09:24:41 -05:00
|
|
|
path: 'showThresholdLabels',
|
2020-05-08 05:40:42 -05:00
|
|
|
name: 'Show threshold labels',
|
2020-03-28 17:11:50 -05:00
|
|
|
description: 'Render the threshold values around the gauge bar',
|
2022-05-25 08:18:21 -05:00
|
|
|
defaultValue: defaultPanelOptions.showThresholdLabels,
|
2020-03-28 17:11:50 -05:00
|
|
|
})
|
|
|
|
.addBooleanSwitch({
|
2020-04-06 09:24:41 -05:00
|
|
|
path: 'showThresholdMarkers',
|
2020-03-28 17:11:50 -05:00
|
|
|
name: 'Show threshold markers',
|
|
|
|
description: 'Renders the thresholds as an outer bar',
|
2022-05-25 08:18:21 -05:00
|
|
|
defaultValue: defaultPanelOptions.showThresholdMarkers,
|
2020-03-28 17:11:50 -05:00
|
|
|
});
|
2021-03-25 02:33:13 -05:00
|
|
|
|
2021-05-19 10:33:56 -05:00
|
|
|
commonOptionsBuilder.addTextSizeOptions(builder);
|
2020-03-28 17:11:50 -05:00
|
|
|
})
|
2019-08-18 17:01:07 -05:00
|
|
|
.setPanelChangeHandler(gaugePanelChangedHandler)
|
2021-10-25 06:55:06 -05:00
|
|
|
.setSuggestionsSupplier(new GaugeSuggestionsSupplier())
|
2020-04-06 09:24:41 -05:00
|
|
|
.setMigrationHandler(gaugePanelMigrationHandler);
|