Table Panel: Add ability to use text color for value or hide value in gauge cell (#61477)

* BarGauge: New value options

* Fix typings for cell options, add new value mode option for bar gauge cells

* Add BarGauge panel option, tests, and update test dashboard

* Updated

* Added default

* Goodbye trusty console.log

* Update

* Merge changes from main

* Update docs

* Add valuemode doc changes

* Update gdev dashboard

* Update valueMode symbol name to valueDisplayMode

* Use Enums as Opposed to literals, don't calculate values when hidden

* Remove double import

* Fix tests

* One more test fix

* Remove erroneous targets field, fix type of maxDataPoints

* Strip nulls and add index field to Thresholds

* Gen cue

* remove bad targets again

* Fixes

---------

Co-authored-by: Kyle Cunningham <kyle@codeincarnate.com>
Co-authored-by: sam boyer <sdboyer@grafana.com>
This commit is contained in:
Torkel Ödegaard
2023-03-10 14:41:46 +01:00
committed by GitHub
co-authored by Kyle Cunningham sam boyer
parent 0a4d9f01e8
commit 73ce20ab48
25 changed files with 2259 additions and 1570 deletions
@@ -593,6 +593,15 @@ export enum BarGaugeDisplayMode {
Lcd = 'lcd',
}
/**
* Allows for the table cell gauge display type to set the gauge mode.
*/
export enum BarGaugeValueMode {
Color = 'color',
Hidden = 'hidden',
Text = 'text',
}
/**
* TODO docs
*/
@@ -697,6 +706,7 @@ export interface TableImageCellOptions {
export interface TableBarGaugeCellOptions {
mode?: BarGaugeDisplayMode;
type: TableCellDisplayMode.Gauge;
valueDisplayMode?: BarGaugeValueMode;
}
/**
@@ -242,6 +242,9 @@ VizLegendOptions: {
// for the bar gauge component of Grafana UI
BarGaugeDisplayMode: "basic" | "lcd" | "gradient" @cuetsy(kind="enum")
// Allows for the table cell gauge display type to set the gauge mode.
BarGaugeValueMode: "color" | "text" | "hidden" @cuetsy(kind="enum")
// TODO docs
VizTooltipOptions: {
mode: TooltipDisplayMode
@@ -52,6 +52,7 @@ TableImageCellOptions: {
TableBarGaugeCellOptions: {
type: TableCellDisplayMode & "gauge"
mode?: BarGaugeDisplayMode
valueDisplayMode?: BarGaugeValueMode
} @cuetsy(kind="interface")
// Sparkline cell options
@@ -238,6 +238,10 @@ export interface Threshold {
* TODO docs
*/
color: string;
/**
* Threshold index, an old property that is not needed an should only appear in older dashboards
*/
index?: number;
/**
* TODO docs
* TODO are the values here enumerable into a disjunction?