mirror of
https://github.com/grafana/grafana.git
synced 2025-02-20 11:48:34 -06:00
* Remove deprecated setDefault usages * Add simple support for conditinal field config properties * Use new API in NewsPanel * Update tests * Fix check
52 lines
1.5 KiB
TypeScript
52 lines
1.5 KiB
TypeScript
import { sharedSingleStatMigrationHandler, sharedSingleStatPanelChangedHandler } from '@grafana/ui';
|
|
import { PanelPlugin } from '@grafana/data';
|
|
import { StatPanelOptions, addStandardDataReduceOptions } from './types';
|
|
import { StatPanel } from './StatPanel';
|
|
|
|
export const plugin = new PanelPlugin<StatPanelOptions>(StatPanel)
|
|
.useFieldConfig()
|
|
.setPanelOptions(builder => {
|
|
addStandardDataReduceOptions(builder);
|
|
|
|
builder
|
|
.addRadio({
|
|
path: 'colorMode',
|
|
name: 'Color mode',
|
|
description: 'Color either the value or the background',
|
|
defaultValue: 'value',
|
|
settings: {
|
|
options: [
|
|
{ value: 'value', label: 'Value' },
|
|
{ value: 'background', label: 'Background' },
|
|
],
|
|
},
|
|
})
|
|
.addRadio({
|
|
path: 'graphMode',
|
|
name: 'Graph mode',
|
|
description: 'Stat panel graph / sparkline mode',
|
|
defaultValue: 'area',
|
|
settings: {
|
|
options: [
|
|
{ value: 'none', label: 'None' },
|
|
{ value: 'area', label: 'Area' },
|
|
],
|
|
},
|
|
})
|
|
.addRadio({
|
|
path: 'justifyMode',
|
|
name: 'Justify mode',
|
|
description: 'Value & title posititioning',
|
|
defaultValue: 'auto',
|
|
settings: {
|
|
options: [
|
|
{ value: 'auto', label: 'Auto' },
|
|
{ value: 'center', label: 'Center' },
|
|
],
|
|
},
|
|
});
|
|
})
|
|
.setNoPadding()
|
|
.setPanelChangeHandler(sharedSingleStatPanelChangedHandler)
|
|
.setMigrationHandler(sharedSingleStatMigrationHandler);
|