diff --git a/public/app/plugins/datasource/influxdb/influx_query.ts b/public/app/plugins/datasource/influxdb/influx_query.ts index 065b85cf175..89cba55773f 100644 --- a/public/app/plugins/datasource/influxdb/influx_query.ts +++ b/public/app/plugins/datasource/influxdb/influx_query.ts @@ -21,6 +21,7 @@ export default class InfluxQuery { target.policy = target.policy || 'default'; target.dsType = 'influxdb'; target.resultFormat = target.resultFormat || 'time_series'; + target.orderByTime = target.orderByTime || 'ASC'; target.tags = target.tags || []; target.groupBy = target.groupBy || [ {type: 'time', params: ['$__interval']}, diff --git a/public/app/plugins/datasource/influxdb/partials/query.editor.html b/public/app/plugins/datasource/influxdb/partials/query.editor.html index f718fbc5d29..509a0d473eb 100644 --- a/public/app/plugins/datasource/influxdb/partials/query.editor.html +++ b/public/app/plugins/datasource/influxdb/partials/query.editor.html @@ -72,11 +72,33 @@ +
+
+ +
+ +
+
+ +
+ + +
+ +
+ + +
+
+
+
+
+
- +
diff --git a/public/app/plugins/datasource/influxdb/query_ctrl.ts b/public/app/plugins/datasource/influxdb/query_ctrl.ts index 26f09d26d29..f78ed0727db 100644 --- a/public/app/plugins/datasource/influxdb/query_ctrl.ts +++ b/public/app/plugins/datasource/influxdb/query_ctrl.ts @@ -14,6 +14,7 @@ export class InfluxQueryCtrl extends QueryCtrl { queryBuilder: any; groupBySegment: any; resultFormats: any[]; + orderByTime: any[]; policySegment: any; tagSegments: any[]; selectMenu: any; @@ -32,6 +33,10 @@ export class InfluxQueryCtrl extends QueryCtrl { {text: 'Time series', value: 'time_series'}, {text: 'Table', value: 'table'}, ]; + this.orderByTime = [ + {text: 'Ascending', value: 'ASC'}, + {text: 'Descending', value: 'DESC'}, + ]; this.policySegment = uiSegmentSrv.newSegment(this.target.policy);