mirror of
https://github.com/grafana/grafana.git
synced 2025-09-22 13:33:51 +08:00

* user essentials mob! 🔱 * user essentials mob! 🔱 * user essentials mob! 🔱 lastFile:public/app/plugins/panel/stat/types.ts * user essentials mob! 🔱 * user essentials mob! 🔱 * Use generate defaults, and fix a few remaining issues * Add annolist to dashboard dist plugins * minor fixes Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com> Co-authored-by: Joao Silva <joao.silva@grafana.com> Co-authored-by: Alexandra Vargas <alexa1866@gmail.com> Co-authored-by: sam boyer <sdboyer@grafana.com>
81 lines
2.8 KiB
TypeScript
81 lines
2.8 KiB
TypeScript
import { PanelPlugin } from '@grafana/data';
|
|
import { BigValueColorMode, BigValueGraphMode, BigValueJustifyMode, BigValueTextMode } from '@grafana/schema';
|
|
import { commonOptionsBuilder, sharedSingleStatMigrationHandler } from '@grafana/ui';
|
|
|
|
import { statPanelChangedHandler } from './StatMigrations';
|
|
import { StatPanel } from './StatPanel';
|
|
import { addStandardDataReduceOptions, addOrientationOption } from './common';
|
|
import { defaultPanelOptions, PanelOptions } from './models.gen';
|
|
import { StatSuggestionsSupplier } from './suggestions';
|
|
|
|
export const plugin = new PanelPlugin<PanelOptions>(StatPanel)
|
|
.useFieldConfig()
|
|
.setPanelOptions((builder) => {
|
|
const mainCategory = ['Stat styles'];
|
|
|
|
addStandardDataReduceOptions(builder);
|
|
addOrientationOption(builder, mainCategory);
|
|
commonOptionsBuilder.addTextSizeOptions(builder);
|
|
|
|
builder.addSelect({
|
|
path: 'textMode',
|
|
name: 'Text mode',
|
|
description: 'Control if name and value is displayed or just name',
|
|
category: mainCategory,
|
|
settings: {
|
|
options: [
|
|
{ value: BigValueTextMode.Auto, label: 'Auto' },
|
|
{ value: BigValueTextMode.Value, label: 'Value' },
|
|
{ value: BigValueTextMode.ValueAndName, label: 'Value and name' },
|
|
{ value: BigValueTextMode.Name, label: 'Name' },
|
|
{ value: BigValueTextMode.None, label: 'None' },
|
|
],
|
|
},
|
|
defaultValue: defaultPanelOptions.textMode,
|
|
});
|
|
|
|
builder
|
|
.addRadio({
|
|
path: 'colorMode',
|
|
name: 'Color mode',
|
|
defaultValue: BigValueColorMode.Value,
|
|
category: mainCategory,
|
|
settings: {
|
|
options: [
|
|
{ value: BigValueColorMode.None, label: 'None' },
|
|
{ value: BigValueColorMode.Value, label: 'Value' },
|
|
{ value: BigValueColorMode.Background, label: 'Background' },
|
|
],
|
|
},
|
|
})
|
|
.addRadio({
|
|
path: 'graphMode',
|
|
name: 'Graph mode',
|
|
description: 'Stat panel graph / sparkline mode',
|
|
category: mainCategory,
|
|
defaultValue: defaultPanelOptions.graphMode,
|
|
settings: {
|
|
options: [
|
|
{ value: BigValueGraphMode.None, label: 'None' },
|
|
{ value: BigValueGraphMode.Area, label: 'Area' },
|
|
],
|
|
},
|
|
})
|
|
.addRadio({
|
|
path: 'justifyMode',
|
|
name: 'Text alignment',
|
|
defaultValue: defaultPanelOptions.justifyMode,
|
|
category: mainCategory,
|
|
settings: {
|
|
options: [
|
|
{ value: BigValueJustifyMode.Auto, label: 'Auto' },
|
|
{ value: BigValueJustifyMode.Center, label: 'Center' },
|
|
],
|
|
},
|
|
});
|
|
})
|
|
.setNoPadding()
|
|
.setPanelChangeHandler(statPanelChangedHandler)
|
|
.setSuggestionsSupplier(new StatSuggestionsSupplier())
|
|
.setMigrationHandler(sharedSingleStatMigrationHandler);
|