From 4bd83443f879c3ce145b9c2720e339b20134be54 Mon Sep 17 00:00:00 2001 From: Denis Doria Date: Sat, 8 Aug 2015 17:00:10 +0200 Subject: [PATCH] Fixing issue for missing tag.operator This should fix the case from when we migrate from a version that doesn't contain tag.operator. --- public/app/plugins/datasource/influxdb/queryCtrl.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/public/app/plugins/datasource/influxdb/queryCtrl.js b/public/app/plugins/datasource/influxdb/queryCtrl.js index a536a8eee35..c5697268297 100644 --- a/public/app/plugins/datasource/influxdb/queryCtrl.js +++ b/public/app/plugins/datasource/influxdb/queryCtrl.js @@ -35,7 +35,13 @@ function (angular, _, InfluxQueryBuilder) { $scope.tagSegments.push(MetricSegment.newCondition(tag.condition)); } $scope.tagSegments.push(new MetricSegment({value: tag.key, type: 'key', cssClass: 'query-segment-key' })); - $scope.tagSegments.push(MetricSegment.newOperator(tag.operator)); + if (tag.operator) { + $scope.tagSegments.push(MetricSegment.newOperator(tag.operator)); + } else if (/^\/.*\/$/.test(tag.value)) { + $scope.tagSegments.push(MetricSegment.newOperator('=~')); + } else { + $scope.tagSegments.push(MetricSegment.newOperator('=')); + } $scope.tagSegments.push(new MetricSegment({value: tag.value, type: 'value', cssClass: 'query-segment-value'})); });