From c6b93ef3c01bef429b7d30ee7a622cc41083f5df Mon Sep 17 00:00:00 2001 From: rozetko Date: Tue, 10 May 2022 18:21:02 +0400 Subject: [PATCH] all options --- src/module.ts | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/module.ts b/src/module.ts index ce2912e..18f561e 100644 --- a/src/module.ts +++ b/src/module.ts @@ -53,6 +53,7 @@ export const plugin = new PanelPlugin(Panel).setPanelOptions((buil category: ['Extremum'], showIf: (config) => config.visualizationType === Pod.GAUGE && !config.gauge.min.useMetric, }) + // TODO: move these 2 editors into one-row custom editor .addFieldNamePicker({ name: 'Min', path: 'gauge.min.metricName', @@ -67,6 +68,37 @@ export const plugin = new PanelPlugin(Panel).setPanelOptions((buil showIf: (config) => config.visualizationType === Pod.GAUGE, }) + // note: `gauge.unit` will contain unit name, not it's string representation + // to format value with unit, use `getValueFormat` function from `@grafana/data` + .addUnitPicker({ + path: 'gauge.unit', + name: 'Unit', + category: ['Value Format'], + showIf: (config) => config.visualizationType === Pod.GAUGE, + }) + .addNumberInput({ + path: 'gauge.decimals', + name: 'Decimals', + settings: { + placeholder: 'auto', + min: 0, + max: 5, + }, + category: ['Value Format'], + showIf: (config) => config.visualizationType === Pod.GAUGE, + }) + .addSliderInput({ + path: 'gauge.size', + defaultValue: 20, + name: 'Size (px)', + settings: { + min: 1, + max: 50, + }, + category: ['Value Format'], + showIf: (config) => config.visualizationType === Pod.GAUGE, + }) + .addNumberInput({ path: 'gauge.max.value', name: 'Max',