Commit 99c1c16a by Torkel Ödegaard Committed by GitHub

DataFormats: When transforming TableModel -> DataFrame -> Table preserve the…

DataFormats: When transforming TableModel -> DataFrame -> Table preserve the type attribute (#19621)
parent 6f0faa59
...@@ -124,11 +124,13 @@ describe('SerisData backwards compatibility', () => { ...@@ -124,11 +124,13 @@ describe('SerisData backwards compatibility', () => {
const table = { const table = {
columns: [], columns: [],
rows: [], rows: [],
type: 'table',
}; };
const series = toDataFrame(table); const series = toDataFrame(table);
const roundtrip = toLegacyResponseData(series) as TableData; const roundtrip = toLegacyResponseData(series) as TableData;
expect(roundtrip.columns.length).toBe(0); expect(roundtrip.columns.length).toBe(0);
expect(roundtrip.type).toBe('table');
}); });
it('converts TableData to series and back again', () => { it('converts TableData to series and back again', () => {
......
...@@ -299,6 +299,7 @@ export const toLegacyResponseData = (frame: DataFrame): TimeSeries | TableData = ...@@ -299,6 +299,7 @@ export const toLegacyResponseData = (frame: DataFrame): TimeSeries | TableData =
} }
return { text: name }; return { text: name };
}), }),
type: 'table',
refId: frame.refId, refId: frame.refId,
meta: frame.meta, meta: frame.meta,
rows, rows,
......
...@@ -47,6 +47,7 @@ export interface TableData extends QueryResultBase { ...@@ -47,6 +47,7 @@ export interface TableData extends QueryResultBase {
name?: string; name?: string;
columns: Column[]; columns: Column[];
rows: any[][]; rows: any[][];
type?: string;
} }
export type TimeSeriesValue = number | null; export type TimeSeriesValue = number | null;
......
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