grafana/public/app/plugins/panel/gauge/module.tsx
sam boyer 48b620231e
Kindsys: Unique names for composable kind TS types (#61928)
* Kindsys: Unique names for composable kind TS types

* Update all TS imports
2023-01-23 18:03:44 +00:00

47 lines
1.6 KiB
TypeScript

import { PanelPlugin } from '@grafana/data';
import { commonOptionsBuilder } from '@grafana/ui';
import { addOrientationOption, addStandardDataReduceOptions } from '../stat/common';
import { gaugePanelMigrationHandler, gaugePanelChangedHandler } from './GaugeMigrations';
import { GaugePanel } from './GaugePanel';
import { PanelOptions, defaultPanelOptions } from './panelcfg.gen';
import { GaugeSuggestionsSupplier } from './suggestions';
export const plugin = new PanelPlugin<PanelOptions>(GaugePanel)
.useFieldConfig({
useCustomConfig: (builder) => {
builder.addNumberInput({
path: 'neutral',
name: 'Neutral',
description: 'Leave empty to use Min as neutral point',
category: ['Gauge'],
settings: {
placeholder: 'auto',
},
});
},
})
.setPanelOptions((builder) => {
addStandardDataReduceOptions(builder);
addOrientationOption(builder);
builder
.addBooleanSwitch({
path: 'showThresholdLabels',
name: 'Show threshold labels',
description: 'Render the threshold values around the gauge bar',
defaultValue: defaultPanelOptions.showThresholdLabels,
})
.addBooleanSwitch({
path: 'showThresholdMarkers',
name: 'Show threshold markers',
description: 'Renders the thresholds as an outer bar',
defaultValue: defaultPanelOptions.showThresholdMarkers,
});
commonOptionsBuilder.addTextSizeOptions(builder);
})
.setPanelChangeHandler(gaugePanelChangedHandler)
.setSuggestionsSupplier(new GaugeSuggestionsSupplier())
.setMigrationHandler(gaugePanelMigrationHandler);