From 42caf02fb03d703e7135f810b7534436e0a2344f Mon Sep 17 00:00:00 2001 From: Denis Doria Date: Sun, 9 Aug 2015 11:58:08 +0200 Subject: [PATCH] Include context for operators Depending of the value a different set of operators will show up. If regex only =~ and !~ will show up. Any other value will show =, <>, <, >. --- public/app/plugins/datasource/influxdb/queryCtrl.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/public/app/plugins/datasource/influxdb/queryCtrl.js b/public/app/plugins/datasource/influxdb/queryCtrl.js index c5697268297..0278a2c3097 100644 --- a/public/app/plugins/datasource/influxdb/queryCtrl.js +++ b/public/app/plugins/datasource/influxdb/queryCtrl.js @@ -156,10 +156,12 @@ function (angular, _, InfluxQueryBuilder) { query = $scope.queryBuilder.buildExploreQuery('TAG_VALUES', $scope.tagSegments[index-2].value); } else if (segment.type === 'condition') { return $q.when([new MetricSegment('AND'), new MetricSegment('OR')]); - } else if (segment.type === 'operator') { + } else if (segment.type === 'operator' && /^(?!\/.*\/$)/.test($scope.tagSegments[index+1].value)) { return $q.when([MetricSegment.newOperator('='), MetricSegment.newOperator('<>'), - MetricSegment.newOperator('<'), MetricSegment.newOperator('>'), - MetricSegment.newOperator('=~'), MetricSegment.newOperator('!~')]); + MetricSegment.newOperator('<'), MetricSegment.newOperator('>')]); + + } else if (segment.type === 'operator' && /^\/.*\/$/.test($scope.tagSegments[index+1].value)) { + return $q.when([ MetricSegment.newOperator('=~'), MetricSegment.newOperator('!~')]); } else { return $q.when([]);