mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fix: make sure that we the gauge panel can handle scenario with no data. (#24938)
* make sure that we can handle the empty data scenario in the gauge. * reverted Guague.tsx and set default values on no data.
This commit is contained in:
parent
47b2650a99
commit
f795a1577c
@ -161,6 +161,18 @@ describe('FieldDisplay', () => {
|
||||
expect(display[0].display.numeric).toEqual(0);
|
||||
});
|
||||
|
||||
it('Should always return defaults with min/max 0 when there is no data', () => {
|
||||
const options = createEmptyDisplayOptions({
|
||||
fieldConfig: {
|
||||
defaults: {},
|
||||
},
|
||||
});
|
||||
|
||||
const display = getFieldDisplayValues(options);
|
||||
expect(display[0].field.min).toEqual(0);
|
||||
expect(display[0].field.max).toEqual(0);
|
||||
});
|
||||
|
||||
describe('Value mapping', () => {
|
||||
it('should apply value mapping', () => {
|
||||
const mappingConfig = [
|
||||
|
@ -275,6 +275,8 @@ function createNoValuesFieldDisplay(options: GetFieldDisplayValuesOptions): Fiel
|
||||
name: displayName,
|
||||
field: {
|
||||
...defaults,
|
||||
max: defaults.max ?? 0,
|
||||
min: defaults.min ?? 0,
|
||||
},
|
||||
display: {
|
||||
text,
|
||||
|
Loading…
Reference in New Issue
Block a user