Logs: Fix toggleable filters to be applied for specified query (#81368)

This commit is contained in:
Ivana Huckova 2024-01-26 15:29:23 +01:00 committed by GitHub
parent f943c27786
commit 8c212a1952
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 0 deletions

View File

@ -1636,6 +1636,7 @@ const mockLogRow = {
},
{ name: 'labels', type: FieldType.other, values: [{ app: 'app01' }, { app: 'app02' }] },
],
refId: 'Z',
}),
rowIndex: 0,
} as unknown as LogRowModel;
@ -1674,4 +1675,9 @@ describe('logRowToDataFrame', () => {
expect(result).toBe(null);
});
it('should use refId from original DataFrame', () => {
const result = logRowToSingleRowDataFrame(mockLogRow);
expect(result?.refId).toBe(mockLogRow.dataFrame.refId);
});
});

View File

@ -844,6 +844,7 @@ export function logRowToSingleRowDataFrame(logRow: LogRowModel): DataFrame | nul
// create a new data frame containing only the single row from `logRow`
const frame = createDataFrame({
fields: originFrame.fields.map((field) => ({ ...field, values: [field.values[logRow.rowIndex]] })),
refId: originFrame.refId,
});
return frame;