2020-04-25 04:00:27 -05:00
|
|
|
import { sharedSingleStatMigrationHandler } from '@grafana/ui';
|
2020-04-02 06:24:50 -05:00
|
|
|
import { PanelPlugin } from '@grafana/data';
|
2020-04-08 12:21:26 -05:00
|
|
|
import { StatPanelOptions, addStandardDataReduceOptions } from './types';
|
2019-11-25 18:13:14 -06:00
|
|
|
import { StatPanel } from './StatPanel';
|
2020-04-25 04:00:27 -05:00
|
|
|
import { statPanelChangedHandler } from './StatMigrations';
|
2019-03-14 15:20:24 -05:00
|
|
|
|
2019-11-25 18:13:14 -06:00
|
|
|
export const plugin = new PanelPlugin<StatPanelOptions>(StatPanel)
|
2020-04-06 09:24:41 -05:00
|
|
|
.useFieldConfig()
|
2020-03-28 17:11:50 -05:00
|
|
|
.setPanelOptions(builder => {
|
|
|
|
addStandardDataReduceOptions(builder);
|
|
|
|
|
|
|
|
builder
|
|
|
|
.addRadio({
|
2020-04-06 09:24:41 -05:00
|
|
|
path: 'colorMode',
|
2020-03-28 17:11:50 -05:00
|
|
|
name: 'Color mode',
|
|
|
|
description: 'Color either the value or the background',
|
2020-04-08 12:21:26 -05:00
|
|
|
defaultValue: 'value',
|
2020-03-28 17:11:50 -05:00
|
|
|
settings: {
|
|
|
|
options: [
|
|
|
|
{ value: 'value', label: 'Value' },
|
|
|
|
{ value: 'background', label: 'Background' },
|
|
|
|
],
|
|
|
|
},
|
|
|
|
})
|
|
|
|
.addRadio({
|
2020-04-06 09:24:41 -05:00
|
|
|
path: 'graphMode',
|
2020-03-28 17:11:50 -05:00
|
|
|
name: 'Graph mode',
|
|
|
|
description: 'Stat panel graph / sparkline mode',
|
2020-04-08 12:21:26 -05:00
|
|
|
defaultValue: 'area',
|
2020-03-28 17:11:50 -05:00
|
|
|
settings: {
|
|
|
|
options: [
|
|
|
|
{ value: 'none', label: 'None' },
|
|
|
|
{ value: 'area', label: 'Area' },
|
|
|
|
],
|
|
|
|
},
|
|
|
|
})
|
|
|
|
.addRadio({
|
2020-04-06 09:24:41 -05:00
|
|
|
path: 'justifyMode',
|
2020-05-08 05:40:42 -05:00
|
|
|
name: 'Alignment mode',
|
2020-03-28 17:11:50 -05:00
|
|
|
description: 'Value & title posititioning',
|
2020-04-08 12:21:26 -05:00
|
|
|
defaultValue: 'auto',
|
2020-03-28 17:11:50 -05:00
|
|
|
settings: {
|
|
|
|
options: [
|
|
|
|
{ value: 'auto', label: 'Auto' },
|
|
|
|
{ value: 'center', label: 'Center' },
|
|
|
|
],
|
|
|
|
},
|
|
|
|
});
|
|
|
|
})
|
2019-11-25 15:26:18 -06:00
|
|
|
.setNoPadding()
|
2020-04-25 04:00:27 -05:00
|
|
|
.setPanelChangeHandler(statPanelChangedHandler)
|
2020-04-06 09:24:41 -05:00
|
|
|
.setMigrationHandler(sharedSingleStatMigrationHandler);
|