diff --git a/public/app/plugins/datasource/influxdb/partials/query.editor.html b/public/app/plugins/datasource/influxdb/partials/query.editor.html index 31bc7e6d8ad..2d613c034b2 100644 --- a/public/app/plugins/datasource/influxdb/partials/query.editor.html +++ b/public/app/plugins/datasource/influxdb/partials/query.editor.html @@ -1,7 +1,7 @@
- +
@@ -72,44 +72,51 @@
-
-
- - -
- -
-
- -
- - -
- -
- - -
-
+
+
+ + + +
+
-
-
+
-
-
- - -
-
- -
- +
+
+ + +
+
+
-
-
-
-
-
+
+ +
+
+ + +
+
+
+
+
+ +
+
+ + +
+
+ +
+ +
+
+
+
+
+
diff --git a/public/app/plugins/datasource/influxdb/query_ctrl.ts b/public/app/plugins/datasource/influxdb/query_ctrl.ts index c676c222d94..2240183fa48 100644 --- a/public/app/plugins/datasource/influxdb/query_ctrl.ts +++ b/public/app/plugins/datasource/influxdb/query_ctrl.ts @@ -33,11 +33,6 @@ export class InfluxQueryCtrl extends QueryCtrl { {text: 'Time series', value: 'time_series'}, {text: 'Table', value: 'table'}, ]; - this.orderByTime = [ - {text: 'ASC', value: 'ASC'}, - {text: 'DESC', value: 'DESC'}, - ]; - this.policySegment = uiSegmentSrv.newSegment(this.target.policy); if (!this.target.measurement) { @@ -70,6 +65,10 @@ export class InfluxQueryCtrl extends QueryCtrl { this.removeTagFilterSegment = uiSegmentSrv.newSegment({fake: true, value: '-- remove tag filter --'}); } + removeOrderByTime() { + this.target.orderByTime = 'ASC'; + } + buildSelectMenu() { var categories = queryPart.getCategories(); this.selectMenu = _.reduce(categories, function(memo, cat, key) { @@ -92,6 +91,15 @@ export class InfluxQueryCtrl extends QueryCtrl { if (!this.queryModel.hasFill()) { options.push(this.uiSegmentSrv.newSegment({value: 'fill(null)'})); } + if (!this.target.limit) { + options.push(this.uiSegmentSrv.newSegment({value: 'LIMIT'})); + } + if (!this.target.slimit) { + options.push(this.uiSegmentSrv.newSegment({value: 'SLIMIT'})); + } + if (this.target.orderByTime === 'ASC') { + options.push(this.uiSegmentSrv.newSegment({value: 'ORDER BY time DESC'})); + } if (!this.queryModel.hasGroupByTime()) { options.push(this.uiSegmentSrv.newSegment({value: 'time($interval)'})); } @@ -103,7 +111,24 @@ export class InfluxQueryCtrl extends QueryCtrl { } groupByAction() { - this.queryModel.addGroupBy(this.groupBySegment.value); + switch (this.groupBySegment.value) { + case 'LIMIT': { + this.target.limit = 10; + break; + } + case 'SLIMIT': { + this.target.slimit = 10; + break; + } + case 'ORDER BY time DESC': { + this.target.orderByTime = 'DESC'; + break; + } + default: { + this.queryModel.addGroupBy(this.groupBySegment.value); + } + } + var plusButton = this.uiSegmentSrv.newPlusButton(); this.groupBySegment.value = plusButton.value; this.groupBySegment.html = plusButton.html;