1import { PanelPlugin } from '@grafana/data';
2import { GaugePanel } from './GaugePanel';
3import { GaugeOptions } from './types';
4import { addOrientationOption, addStandardDataReduceOptions } from '../stat/types';
5import { gaugePanelMigrationHandler, gaugePanelChangedHandler } from './GaugeMigrations';
6import { commonOptionsBuilder } from '@grafana/ui';
7import { GaugeSuggestionsSupplier } from './suggestions';
8
9export const plugin = new PanelPlugin<GaugeOptions>(GaugePanel)
10  .useFieldConfig()
11  .setPanelOptions((builder) => {
12    addStandardDataReduceOptions(builder);
13    addOrientationOption(builder);
14
15    builder
16      .addBooleanSwitch({
17        path: 'showThresholdLabels',
18        name: 'Show threshold labels',
19        description: 'Render the threshold values around the gauge bar',
20        defaultValue: false,
21      })
22      .addBooleanSwitch({
23        path: 'showThresholdMarkers',
24        name: 'Show threshold markers',
25        description: 'Renders the thresholds as an outer bar',
26        defaultValue: true,
27      });
28
29    commonOptionsBuilder.addTextSizeOptions(builder);
30  })
31  .setPanelChangeHandler(gaugePanelChangedHandler)
32  .setSuggestionsSupplier(new GaugeSuggestionsSupplier())
33  .setMigrationHandler(gaugePanelMigrationHandler);
34