Commit d7495491 by Torkel Ödegaard

Templating: Full support for InfluxDB, filter by part of series names, extract…

Templating: Full support for InfluxDB, filter by part of series names, extract series substrings, nested queries, multipe where clauses! Closes #613
parent 58a2ab4f
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
- [Issue #234](https://github.com/grafana/grafana/issues/234). Templating: Interval variable type for time intervals summarize/group by parameter, included "auto" option, and auto step counts option. - [Issue #234](https://github.com/grafana/grafana/issues/234). Templating: Interval variable type for time intervals summarize/group by parameter, included "auto" option, and auto step counts option.
- [Issue #262](https://github.com/grafana/grafana/issues/262). Templating: Ability to use template variables for function parameters via custom variable type, can be used as parameter for movingAverage or scaleToSeconds for example - [Issue #262](https://github.com/grafana/grafana/issues/262). Templating: Ability to use template variables for function parameters via custom variable type, can be used as parameter for movingAverage or scaleToSeconds for example
- [Issue #312](https://github.com/grafana/grafana/issues/312). Templating: Can now use template variables in panel titles - [Issue #312](https://github.com/grafana/grafana/issues/312). Templating: Can now use template variables in panel titles
- [Issue #613](https://github.com/grafana/grafana/issues/613). Templating: Full support for InfluxDB, filter by part of series names, extract series substrings, nested queries, multipe where clauses!
**InfluxDB Breaking changes** **InfluxDB Breaking changes**
- To better support templating, fill(0) and group by time low limit some changes has been made to the editor and query model schema - To better support templating, fill(0) and group by time low limit some changes has been made to the editor and query model schema
......
...@@ -122,11 +122,11 @@ ...@@ -122,11 +122,11 @@
</div> </div>
<div class="editor-option" ng-show="current.includeAll"> <div class="editor-option" ng-show="current.includeAll">
<label class="small">All format</label> <label class="small">All format</label>
<select class="input-medium" ng-model="current.allFormat" ng-change="runQuery()" ng-options="f for f in ['glob', 'wildcard', 'regex wildcard', 'regex all values', 'comma list', 'custom']"></select> <select class="input-medium" ng-model="current.allFormat" ng-change="runQuery()" ng-options="f for f in ['glob', 'wildcard', 'regex wildcard', 'regex values']"></select>
</div> </div>
<div class="editor-option" ng-show="current.includeAll"> <div class="editor-option" ng-show="current.includeAll">
<label class="small">All value</label> <label class="small">All value</label>
<input type="text" class="input-xlarge" ng-disabled="true" ng-model='current.options[0].value'></input> <input type="text" class="input-xlarge" ng-model='current.options[0].value'></input>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -117,7 +117,7 @@ function (angular, _, kbn) { ...@@ -117,7 +117,7 @@ function (angular, _, kbn) {
options = {}; // use object hash to remove duplicates options = {}; // use object hash to remove duplicates
if (variable.regex) { if (variable.regex) {
regex = kbn.stringToJsRegex(variable.regex); regex = kbn.stringToJsRegex(templateSrv.replace(variable.regex));
} }
for (i = 0; i < metricNames.length; i++) { for (i = 0; i < metricNames.length; i++) {
...@@ -148,6 +148,9 @@ function (angular, _, kbn) { ...@@ -148,6 +148,9 @@ function (angular, _, kbn) {
case 'regex wildcard': case 'regex wildcard':
allValue = '.*'; allValue = '.*';
break; break;
case 'regex values':
allValue = '(' + _.pluck(variable.options, 'text').join('|') + ')';
break;
default: default:
allValue = '{'; allValue = '{';
allValue += _.pluck(variable.options, 'text').join(','); allValue += _.pluck(variable.options, 'text').join(',');
......
...@@ -249,6 +249,17 @@ define([ ...@@ -249,6 +249,17 @@ define([
}); });
}); });
describeUpdateVariable('with include all regex all values', function(scenario) {
scenario.setup(function() {
scenario.variable = { type: 'query', query: 'apps.*', name: 'test', includeAll: true, allFormat: 'regex values' };
scenario.queryResult = [{text: 'backend1'}, {text: 'backend2'}, { text: 'backend3'}];
});
it('should add empty glob', function() {
expect(scenario.variable.options[0].value).to.be('(backend1|backend2|backend3)');
});
});
}); });
}); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment