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',