diff --git a/CHANGELOG.md b/CHANGELOG.md index aa3114b39af..1a8450a80e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - [Issue #1298](https://github.com/grafana/grafana/issues/1298). InfluxDB: Fix handling of empty array in templating variable query - [Issue #1309](https://github.com/grafana/grafana/issues/1309). Graph: Fixed issue when using zero as a grid threshold - [Issue #1345](https://github.com/grafana/grafana/issues/1345). UI: Fixed position of confirm modal when scrolled down +- [Issue #1372](https://github.com/grafana/grafana/issues/1372). Graphite: Fix for nested complex queries, where a query references a query that references another query (ie the #[A-Z] syntax) **Tech** - [Issue #1311](https://github.com/grafana/grafana/issues/1311). Tech: Updated Font-Awesome from 3.2 to 4.2 diff --git a/src/app/features/graphite/datasource.js b/src/app/features/graphite/datasource.js index 639e150a320..a486250ac74 100644 --- a/src/app/features/graphite/datasource.js +++ b/src/app/features/graphite/datasource.js @@ -276,6 +276,7 @@ function (angular, _, $, config, kbn, moment) { targetValue = targets[this._seriesRefLetters[i]]; targetValue = targetValue.replace(regex, nestedSeriesRegexReplacer); + targets[this._seriesRefLetters[i]] = targetValue; clean_options.push("target=" + encodeURIComponent(targetValue)); } diff --git a/src/test/specs/graphiteDatasource-specs.js b/src/test/specs/graphiteDatasource-specs.js index e23f0e89d4c..58bc62be7ce 100644 --- a/src/test/specs/graphiteDatasource-specs.js +++ b/src/test/specs/graphiteDatasource-specs.js @@ -74,6 +74,13 @@ define([ expect(results[2]).to.be('target=asPercent(series1%2Cseries2)'); }); + it('should replace target placeholder when nesting query references', function() { + var results = ctx.ds.buildGraphiteParams({ + targets: [{target: 'series1'}, {target: 'sumSeries(#A)'}, {target: 'asPercent(#A,#B)'}] + }); + expect(results[2]).to.be('target=' + encodeURIComponent("asPercent(series1,sumSeries(series1))")); + }); + it('should fix wrong minute interval parameters', function() { var results = ctx.ds.buildGraphiteParams({ targets: [{target: "summarize(prod.25m.count, '25m', 'sum')" }]