mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Combine responses: do not combine frames with different names (#90464)
This commit is contained in:
parent
1ee9df8ac6
commit
8547148623
@ -495,6 +495,36 @@ describe('combineResponses', () => {
|
||||
expect(combineResponses(responseA, responseB).data[0].meta.stats).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
||||
it('does not combine frames with different refId', () => {
|
||||
const { metricFrameA, metricFrameB } = getMockFrames();
|
||||
metricFrameA.refId = 'A';
|
||||
metricFrameB.refId = 'B';
|
||||
const responseA: DataQueryResponse = {
|
||||
data: [metricFrameA],
|
||||
};
|
||||
const responseB: DataQueryResponse = {
|
||||
data: [metricFrameB],
|
||||
};
|
||||
expect(combineResponses(responseA, responseB)).toEqual({
|
||||
data: [metricFrameA, metricFrameB],
|
||||
});
|
||||
});
|
||||
|
||||
it('does not combine frames with different refId', () => {
|
||||
const { metricFrameA, metricFrameB } = getMockFrames();
|
||||
metricFrameA.name = 'A';
|
||||
metricFrameB.name = 'B';
|
||||
const responseA: DataQueryResponse = {
|
||||
data: [metricFrameA],
|
||||
};
|
||||
const responseB: DataQueryResponse = {
|
||||
data: [metricFrameB],
|
||||
};
|
||||
expect(combineResponses(responseA, responseB)).toEqual({
|
||||
data: [metricFrameA, metricFrameB],
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('combinePanelData', () => {
|
||||
|
@ -130,7 +130,7 @@ function cloneDataFrame(frame: DataQueryResponseData): DataQueryResponseData {
|
||||
}
|
||||
|
||||
function shouldCombine(frame1: DataFrame, frame2: DataFrame): boolean {
|
||||
if (frame1.refId !== frame2.refId) {
|
||||
if (frame1.refId !== frame2.refId || frame1.name !== frame2.name) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user