Explorar o código

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 =, <>, <, >.
Denis Doria %!s(int64=10) %!d(string=hai) anos
pai
achega
42caf02fb0
Modificáronse 1 ficheiros con 5 adicións e 3 borrados
  1. 5 3
      public/app/plugins/datasource/influxdb/queryCtrl.js

+ 5 - 3
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);
         query = $scope.queryBuilder.buildExploreQuery('TAG_VALUES', $scope.tagSegments[index-2].value);
       } else if (segment.type === 'condition') {
       } else if (segment.type === 'condition') {
         return $q.when([new MetricSegment('AND'), new MetricSegment('OR')]);
         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('<>'),
         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  {
       else  {
         return $q.when([]);
         return $q.when([]);