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 =, <>, <, >.
This commit is contained in:
Denis Doria 2015-08-09 11:58:08 +02:00
parent 4bd83443f8
commit 42caf02fb0

View File

@ -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([]);