Commit 09c95714 by Zoltán Bedi Committed by GitHub

Explore: table result should not override display property (#27411)

parent 10141c5e
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment