tripnomics_7.5.5/public/app/plugins/panel/bargauge/module.tsx
venbatechnologies@gmail.com 91fce5c4bf Initial commit
2021-07-05 13:49:40 +05:30

31 lines
1.1 KiB
TypeScript

import { sharedSingleStatPanelChangedHandler } from '@grafana/ui';
import { PanelPlugin } from '@grafana/data';
import { BarGaugePanel } from './BarGaugePanel';
import { BarGaugeOptions, displayModes } from './types';
import { addStandardDataReduceOptions } from '../stat/types';
import { barGaugePanelMigrationHandler } from './BarGaugeMigrations';
export const plugin = new PanelPlugin<BarGaugeOptions>(BarGaugePanel)
.useFieldConfig()
.setPanelOptions((builder) => {
addStandardDataReduceOptions(builder);
builder
.addRadio({
path: 'displayMode',
name: 'Display mode',
settings: {
options: displayModes,
},
defaultValue: 'gradient',
})
.addBooleanSwitch({
path: 'showUnfilled',
name: 'Show unfilled area',
description: 'When enabled renders the unfilled region as gray',
defaultValue: true,
showIf: (options: BarGaugeOptions) => options.displayMode !== 'lcd',
});
})
.setPanelChangeHandler(sharedSingleStatPanelChangedHandler)
.setMigrationHandler(barGaugePanelMigrationHandler);