diff --git a/src/app/partials/influxdb/editor.html b/src/app/partials/influxdb/editor.html index ecbb9af28a0..5ed42499ccf 100644 --- a/src/app/partials/influxdb/editor.html +++ b/src/app/partials/influxdb/editor.html @@ -45,7 +45,7 @@ + + + +
+ + +
+ +
+ diff --git a/src/app/partials/templating_editor.html b/src/app/partials/templating_editor.html index fcef0ca8fba..659f0ee1bde 100644 --- a/src/app/partials/templating_editor.html +++ b/src/app/partials/templating_editor.html @@ -101,7 +101,7 @@
- +
diff --git a/src/app/services/influxdb/influxdbDatasource.js b/src/app/services/influxdb/influxdbDatasource.js index d2ca7ae6be5..64f0b7e706a 100644 --- a/src/app/services/influxdb/influxdbDatasource.js +++ b/src/app/services/influxdb/influxdbDatasource.js @@ -124,7 +124,7 @@ function (angular, _, kbn, InfluxSeries) { }; - InfluxDatasource.prototype.annotationQuery = function(annotation, filterSrv, rangeUnparsed) { + InfluxDatasource.prototype.annotationQuery = function(annotation, rangeUnparsed) { var timeFilter = getTimeFilter({ range: rangeUnparsed }); var query = _.template(annotation.query, { timeFilter: timeFilter }, this.templateSettings); @@ -132,9 +132,14 @@ function (angular, _, kbn, InfluxSeries) { return new InfluxSeries({ seriesList: results, annotation: annotation }).getAnnotations(); }); }; - InfluxDatasource.prototype.listColumns = function(seriesName) { - return this._seriesQuery('select * from /' + seriesName + '/ limit 1').then(function(data) { + InfluxDatasource.prototype.listColumns = function(seriesName) { + var interpolated = templateSrv.replace(seriesName); + if (interpolated[0] !== '/') { + interpolated = '/' + interpolated + '/'; + } + + return this._seriesQuery('select * from ' + interpolated + ' limit 1').then(function(data) { if (!data) { return []; } diff --git a/src/test/specs/templateValuesSrv-specs.js b/src/test/specs/templateValuesSrv-specs.js index 37824cbd953..ec5e0376439 100644 --- a/src/test/specs/templateValuesSrv-specs.js +++ b/src/test/specs/templateValuesSrv-specs.js @@ -154,7 +154,7 @@ define([ describeUpdateVariable('with include All glob syntax', function(ctx) { ctx.setup(function() { - ctx.variable = { type: 'query', query: 'apps.*', name: 'test', includeAll: true, allFormat: 'Glob' }; + ctx.variable = { type: 'query', query: 'apps.*', name: 'test', includeAll: true, allFormat: 'glob' }; ctx.queryResult = [{text: 'backend1'}, {text: 'backend2'}, { text: 'backend3'}]; }); @@ -163,6 +163,19 @@ define([ }); }); + describeUpdateVariable('with include all regex wildcard', function(ctx) { + ctx.setup(function() { + ctx.variable = { type: 'query', query: 'apps.*', name: 'test', includeAll: true, allFormat: 'wildcard' }; + ctx.queryResult = [{text: 'backend1'}, {text: 'backend2'}, { text: 'backend3'}]; + }); + + it('should add All wildcard option', function() { + expect(ctx.variable.options[0].value).to.be('*'); + }); + }); + + + }); });