mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Explore: table result should not override display property (#27411)
This commit is contained in:
parent
10141c5e6c
commit
09c9571462
@ -197,6 +197,24 @@ describe('ResultProcessor', () => {
|
||||
expect(result.fields[1].values.toArray()).toEqual([4, 5, 6]);
|
||||
expect(result.fields[2].values.toArray()).toEqual([4, 5, 6]);
|
||||
});
|
||||
|
||||
it('should not override fields display property when filled', () => {
|
||||
const { resultProcessor, dataFrames } = testContext({
|
||||
dataFrames: [
|
||||
toDataFrame({
|
||||
name: 'A-series',
|
||||
refId: 'A',
|
||||
fields: [{ name: 'Text', type: FieldType.string, values: ['someText'] }],
|
||||
}),
|
||||
],
|
||||
});
|
||||
const displayFunctionMock = jest.fn();
|
||||
dataFrames[0].fields[0].display = displayFunctionMock;
|
||||
|
||||
const data = resultProcessor.getTableResult();
|
||||
|
||||
expect(data?.fields[0].display).toBe(displayFunctionMock);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when calling getLogsResult', () => {
|
||||
|
@ -99,11 +99,13 @@ export class ResultProcessor {
|
||||
|
||||
// set display processor
|
||||
for (const field of data.fields) {
|
||||
field.display = getDisplayProcessor({
|
||||
field,
|
||||
theme: config.theme,
|
||||
timeZone: this.timeZone,
|
||||
});
|
||||
field.display =
|
||||
field.display ??
|
||||
getDisplayProcessor({
|
||||
field,
|
||||
theme: config.theme,
|
||||
timeZone: this.timeZone,
|
||||
});
|
||||
}
|
||||
|
||||
return data;
|
||||
|
Loading…
Reference in New Issue
Block a user