diff --git a/public/app/features/logs/logsModel.test.ts b/public/app/features/logs/logsModel.test.ts index 58fa2ec512d..9a1f6d1bb04 100644 --- a/public/app/features/logs/logsModel.test.ts +++ b/public/app/features/logs/logsModel.test.ts @@ -1549,6 +1549,7 @@ const mockLogRow = { }, { name: 'labels', type: FieldType.other, values: [{ app: 'app01' }, { app: 'app02' }] }, ], + refId: 'Z', }), rowIndex: 0, } as unknown as LogRowModel; @@ -1587,4 +1588,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 d49dfd9a414..d2e8fa944b5 100644 --- a/public/app/features/logs/logsModel.ts +++ b/public/app/features/logs/logsModel.ts @@ -809,6 +809,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;