From 8c212a19523e29f29bfc2759a663f547d2e84860 Mon Sep 17 00:00:00 2001 From: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com> Date: Fri, 26 Jan 2024 15:29:23 +0100 Subject: [PATCH] Logs: Fix toggleable filters to be applied for specified query (#81368) --- public/app/features/logs/logsModel.test.ts | 6 ++++++ public/app/features/logs/logsModel.ts | 1 + 2 files changed, 7 insertions(+) diff --git a/public/app/features/logs/logsModel.test.ts b/public/app/features/logs/logsModel.test.ts index 195e60390dd..d5894aeae39 100644 --- a/public/app/features/logs/logsModel.test.ts +++ b/public/app/features/logs/logsModel.test.ts @@ -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); + }); }); diff --git a/public/app/features/logs/logsModel.ts b/public/app/features/logs/logsModel.ts index 488821c901e..d0afaf5c95c 100644 --- a/public/app/features/logs/logsModel.ts +++ b/public/app/features/logs/logsModel.ts @@ -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;