mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 11:42:32 +08:00

* kindsys: Adapt to new PanelCfg schema interface * building locally * Remove Panel prefix in cue files * Regenerate * Update imports * fixup! Merge branch 'remove-panel-prefix' into sdboyer/redundant-panelcfg-prefixes * Fix formatting --------- Co-authored-by: Ryan McKinley <ryantxu@gmail.com> Co-authored-by: Tania B <yalyna.ts@gmail.com>
47 lines
1.6 KiB
TypeScript
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 { Options, defaultOptions } from './panelcfg.gen';
|
|
import { GaugeSuggestionsSupplier } from './suggestions';
|
|
|
|
export const plugin = new PanelPlugin<Options>(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: defaultOptions.showThresholdLabels,
|
|
})
|
|
.addBooleanSwitch({
|
|
path: 'showThresholdMarkers',
|
|
name: 'Show threshold markers',
|
|
description: 'Renders the thresholds as an outer bar',
|
|
defaultValue: defaultOptions.showThresholdMarkers,
|
|
});
|
|
|
|
commonOptionsBuilder.addTextSizeOptions(builder);
|
|
})
|
|
.setPanelChangeHandler(gaugePanelChangedHandler)
|
|
.setSuggestionsSupplier(new GaugeSuggestionsSupplier())
|
|
.setMigrationHandler(gaugePanelMigrationHandler);
|