InfluxDB: add executedQueryString metadata for InfluxQL (#25786)

This commit is contained in:
Ryan McKinley
2020-06-24 13:52:46 -07:00
committed by GitHub
parent 271cc67038
commit fda9b1f089
2 changed files with 34 additions and 14 deletions

View File

@@ -1,20 +1,24 @@
import _ from 'lodash';
import TableModel from 'app/core/table_model';
import { FieldType } from '@grafana/data';
import { FieldType, QueryResultMeta, TimeSeries, TableData } from '@grafana/data';
export default class InfluxSeries {
refId: string;
series: any;
alias: any;
annotation: any;
meta?: QueryResultMeta;
constructor(options: { series: any; alias?: any; annotation?: any }) {
constructor(options: { series: any; alias?: any; annotation?: any; meta?: QueryResultMeta; refId?: string }) {
this.series = options.series;
this.alias = options.alias;
this.annotation = options.annotation;
this.meta = options.meta;
this.refId = options.refId;
}
getTimeSeries() {
const output: any[] = [];
getTimeSeries(): TimeSeries[] {
const output: TimeSeries[] = [];
let i, j;
if (this.series.length === 0) {
@@ -47,7 +51,7 @@ export default class InfluxSeries {
}
}
output.push({ target: seriesName, datapoints: datapoints });
output.push({ target: seriesName, datapoints: datapoints, meta: this.meta, refId: this.refId });
}
});
@@ -143,10 +147,13 @@ export default class InfluxSeries {
return list;
}
getTable() {
getTable(): TableData {
const table = new TableModel();
let i, j;
table.refId = this.refId;
table.meta = this.meta;
if (this.series.length === 0) {
return table;
}