diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b8239bd437..0c57bfcfee2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# 3.0.0-beta6 (unreleased) + +### Bug fixes +* **InfluxDB 0.12**: Fixed issue templating and `show tag values` query only returning tags for first measurement, fixes [#4726](https://github.com/grafana/grafana/issues/4726) +* **Templating**: Fixed issue with regex formating when matching multiple values, fixes [#4755](https://github.com/grafana/grafana/issues/4755) +* **Templating**: Fixed issue with custom all value and escaping, fixes [#4736](https://github.com/grafana/grafana/issues/4736) + # 3.0.0-beta5 (2016-04-15) ### Bug fixes diff --git a/public/app/features/templating/templateSrv.js b/public/app/features/templating/templateSrv.js index 26dc77d36a9..f60414eac43 100644 --- a/public/app/features/templating/templateSrv.js +++ b/public/app/features/templating/templateSrv.js @@ -57,7 +57,7 @@ function (angular, _) { } var escapedValues = _.map(value, regexEscape); - return escapedValues.join('|'); + return '(' + escapedValues.join('|') + ')'; } case "lucene": { if (typeof value === 'string') { @@ -152,6 +152,10 @@ function (angular, _) { value = variable.current.value; if (self.isAllValue(value)) { value = self.getAllValue(variable); + // skip formating of custom all values + if (variable.allValue) { + return value; + } } var res = self.formatValue(value, format, variable); diff --git a/public/test/specs/templateSrv-specs.js b/public/test/specs/templateSrv-specs.js index 4948e1272ce..3334d7a7bfe 100644 --- a/public/test/specs/templateSrv-specs.js +++ b/public/test/specs/templateSrv-specs.js @@ -99,6 +99,11 @@ define([ var target = _templateSrv.replace('this.$test.filters', {}, 'glob'); expect(target).to.be('this.*.filters'); }); + + it('should not escape custom all value', function() { + var target = _templateSrv.replace('this.$test', {}, 'regex'); + expect(target).to.be('this.*'); + }); }); describe('lucene format', function() { @@ -127,7 +132,7 @@ define([ it('multi value and regex format should render regex string', function() { var result = _templateSrv.formatValue(['test.','test2'], 'regex'); - expect(result).to.be('test\\.|test2'); + expect(result).to.be('(test\\.|test2)'); }); it('multi value and pipe should render pipe string', function() {