From 7def403018619f5cd75a0853a0ec4442800c0ab7 Mon Sep 17 00:00:00 2001 From: Peter Holmberg Date: Thu, 31 Jan 2019 13:59:25 +0100 Subject: [PATCH] typing data --- packages/grafana-ui/src/types/datasource.ts | 3 ++- public/app/features/dashboard/dashgrid/DataPanel.tsx | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/grafana-ui/src/types/datasource.ts b/packages/grafana-ui/src/types/datasource.ts index 48fcbbdf29c..44d38ff20e2 100644 --- a/packages/grafana-ui/src/types/datasource.ts +++ b/packages/grafana-ui/src/types/datasource.ts @@ -1,8 +1,9 @@ import { TimeRange, RawTimeRange } from './time'; import { PluginMeta } from './plugin'; +import { TableData, TimeSeries } from './data'; export interface DataQueryResponse { - data: any; + data: TimeSeries[] | [TableData]; } export interface DataQuery { diff --git a/public/app/features/dashboard/dashgrid/DataPanel.tsx b/public/app/features/dashboard/dashgrid/DataPanel.tsx index db71072f189..431a53cd1f2 100644 --- a/public/app/features/dashboard/dashgrid/DataPanel.tsx +++ b/public/app/features/dashboard/dashgrid/DataPanel.tsx @@ -162,14 +162,14 @@ export class DataPanel extends Component { if (response.data.length > 0 && (response.data[0] as TableData).type === 'table') { return { - tableData: response.data, - timeSeries: [] as TimeSeries[], + tableData: response.data[0] as TableData, + timeSeries: null, }; } return { - timeSeries: response.data, - tableData: {} as TableData, + timeSeries: response.data as TimeSeries[], + tableData: null, }; };