Peter Holmberg 7 лет назад
Родитель
Сommit
7def403018

+ 2 - 1
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 {

+ 4 - 4
public/app/features/dashboard/dashgrid/DataPanel.tsx

@@ -162,14 +162,14 @@ export class DataPanel extends Component<Props, State> {
 
     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,
     };
   };