mirror of
https://github.com/grafana/grafana.git
synced 2025-02-20 11:48:34 -06:00
* user essentials mob! 🔱 * Wip * user essentials mob! 🔱 lastFile:public/app/plugins/panel/bargauge/module.tsx * user essentials mob! 🔱 * update betterer results file Co-authored-by: kay delaney <kay@grafana.com> Co-authored-by: Levente Balogh <balogh.levente.hu@gmail.com> Co-authored-by: Joao Silva <joao.silva@grafana.com>
57 lines
2.2 KiB
TypeScript
57 lines
2.2 KiB
TypeScript
import { PanelPlugin, VizOrientation } from '@grafana/data';
|
|
import { BarGaugeDisplayMode } from '@grafana/schema';
|
|
import { commonOptionsBuilder, sharedSingleStatPanelChangedHandler } from '@grafana/ui';
|
|
|
|
import { addOrientationOption, addStandardDataReduceOptions } from '../stat/common';
|
|
|
|
import { barGaugePanelMigrationHandler } from './BarGaugeMigrations';
|
|
import { BarGaugePanel } from './BarGaugePanel';
|
|
import { PanelOptions, defaultPanelOptions } from './models.gen';
|
|
import { BarGaugeSuggestionsSupplier } from './suggestions';
|
|
|
|
export const plugin = new PanelPlugin<PanelOptions>(BarGaugePanel)
|
|
.useFieldConfig()
|
|
.setPanelOptions((builder) => {
|
|
addStandardDataReduceOptions(builder);
|
|
addOrientationOption(builder);
|
|
commonOptionsBuilder.addTextSizeOptions(builder);
|
|
|
|
builder
|
|
.addRadio({
|
|
path: 'displayMode',
|
|
name: 'Display mode',
|
|
settings: {
|
|
options: [
|
|
{ value: BarGaugeDisplayMode.Gradient, label: 'Gradient' },
|
|
{ value: BarGaugeDisplayMode.Lcd, label: 'Retro LCD' },
|
|
{ value: BarGaugeDisplayMode.Basic, label: 'Basic' },
|
|
],
|
|
},
|
|
defaultValue: defaultPanelOptions.displayMode,
|
|
})
|
|
.addBooleanSwitch({
|
|
path: 'showUnfilled',
|
|
name: 'Show unfilled area',
|
|
description: 'When enabled renders the unfilled region as gray',
|
|
defaultValue: defaultPanelOptions.showUnfilled,
|
|
showIf: (options) => options.displayMode !== 'lcd',
|
|
})
|
|
.addNumberInput({
|
|
path: 'minVizWidth',
|
|
name: 'Min width',
|
|
description: 'Minimum column width',
|
|
defaultValue: defaultPanelOptions.minVizWidth,
|
|
showIf: (options) => options.orientation === VizOrientation.Vertical,
|
|
})
|
|
.addNumberInput({
|
|
path: 'minVizHeight',
|
|
name: 'Min height',
|
|
description: 'Minimum row height',
|
|
defaultValue: defaultPanelOptions.minVizHeight,
|
|
showIf: (options) => options.orientation === VizOrientation.Horizontal,
|
|
});
|
|
})
|
|
.setPanelChangeHandler(sharedSingleStatPanelChangedHandler)
|
|
.setMigrationHandler(barGaugePanelMigrationHandler)
|
|
.setSuggestionsSupplier(new BarGaugeSuggestionsSupplier());
|