mirror of
https://github.com/grafana/grafana.git
synced 2025-02-14 09:33:34 -06:00
Geomap: Fix tooltip field name regression (#75511)
This commit is contained in:
parent
ad851ea952
commit
7875dbc6eb
@ -15,6 +15,11 @@ function checkScenario(scenario: TitleScenario): string {
|
||||
return getFieldDisplayName(field, frame, scenario.frames);
|
||||
}
|
||||
|
||||
jest.mock('lodash', () => ({
|
||||
...jest.requireActual('lodash'),
|
||||
isEqual: jest.fn().mockImplementation((obj1, obj2) => obj1 === obj2),
|
||||
}));
|
||||
|
||||
describe('getFieldDisplayName', () => {
|
||||
it('Should add suffix for comparison frames', () => {
|
||||
const frame = toDataFrame({
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { isEqual } from 'lodash';
|
||||
|
||||
import { DataFrame, Field, TIME_SERIES_VALUE_FIELD_NAME, FieldType, TIME_SERIES_TIME_FIELD_NAME } from '../types';
|
||||
import { formatLabels } from '../utils/labels';
|
||||
|
||||
@ -165,7 +167,7 @@ function getUniqueFieldName(field: Field, frame?: DataFrame) {
|
||||
for (let i = 0; i < frame.fields.length; i++) {
|
||||
const otherField = frame.fields[i];
|
||||
|
||||
if (field === otherField) {
|
||||
if (isEqual(field, otherField)) {
|
||||
foundSelf = true;
|
||||
|
||||
if (dupeCount > 0) {
|
||||
|
@ -72,8 +72,11 @@ export const DataHoverView = ({ data, rowIndex, columnIndex, sortOrder, mode, he
|
||||
});
|
||||
}
|
||||
|
||||
// Sanitize field by removing hovered property to fix unique display name issue
|
||||
const { hovered, ...sanitizedField } = field;
|
||||
|
||||
displayValues.push({
|
||||
name: getFieldDisplayName(field, data),
|
||||
name: getFieldDisplayName(sanitizedField, data),
|
||||
value,
|
||||
valueString: formattedValueToString(fieldDisplay),
|
||||
highlight: field.hovered,
|
||||
|
Loading…
Reference in New Issue
Block a user