mirror of
https://github.com/grafana/grafana.git
synced 2025-01-27 00:37:04 -06:00
Prometheus: Fixes issue where legend name was replaced with name Value in stat & gauge panels (#35863)
This commit is contained in:
parent
e1e2bd545a
commit
22203fd4df
@ -411,6 +411,36 @@ describe('FieldDisplay', () => {
|
||||
expect(result[1].display.title).toEqual('Norway Oslo');
|
||||
expect(result[1].display.text).toEqual('20');
|
||||
});
|
||||
|
||||
it('When showing all values for field with displayNameFromDS', () => {
|
||||
const options = createDisplayOptions({
|
||||
reduceOptions: {
|
||||
values: true,
|
||||
calcs: [],
|
||||
},
|
||||
fieldConfig: { overrides: [], defaults: {} },
|
||||
data: [
|
||||
toDataFrame({
|
||||
fields: [
|
||||
{
|
||||
name: 'Time',
|
||||
values: [1],
|
||||
},
|
||||
{
|
||||
name: 'Value',
|
||||
values: [10],
|
||||
config: {
|
||||
displayNameFromDS: 'NewName',
|
||||
},
|
||||
},
|
||||
],
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
const result = getFieldDisplayValues(options);
|
||||
expect(result[0].display.title).toEqual('NewName');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -274,7 +274,7 @@ function getSmartDisplayNameForRow(
|
||||
}
|
||||
|
||||
if (otherNumericFields || parts.length === 0) {
|
||||
parts.push(getFieldDisplayName(field));
|
||||
parts.push(getFieldDisplayName(field, frame));
|
||||
}
|
||||
|
||||
return parts.join(' ');
|
||||
|
Loading…
Reference in New Issue
Block a user