Commit 1eadf52f by Pauly Myjavec

Fixes regex InfluxDB queries intoduced in 1.6.0

Do not encapsulate regex with quotes in query string
Fix the way series names are displayed, do not use column name but
rather series names
parent 810f46c4
......@@ -68,7 +68,7 @@ function (angular, _, kbn) {
}
else {
var template = "select [[group]][[group_comma]] [[func]](\"[[column]]\") as \"[[column]]_[[func]]\" from \"[[series]]\" " +
var template = "select [[group]][[group_comma]] [[func]](\"[[column]]\") as \"[[column]]_[[func]]\" from [[series]] " +
"where [[timeFilter]] [[condition_add]] [[condition_key]] [[condition_op]] [[condition_value]] " +
"group by time([[interval]])[[group_comma]] [[group]] order asc";
......@@ -86,6 +86,10 @@ function (angular, _, kbn) {
group: target.groupby_field_add ? target.groupby_field : '',
};
if(!templateData.series.match('^/.*/')) {
templateData.series = '"' + templateData.series + '"';
}
query = _.template(template, templateData, this.templateSettings);
query = filterSrv.applyTemplateToTarget(query);
......@@ -112,12 +116,11 @@ function (angular, _, kbn) {
};
InfluxDatasource.prototype.listColumns = function(seriesName) {
return this.doInfluxRequest('select * from "' + seriesName + '" limit 1').then(function(data) {
return this.doInfluxRequest('select * from /' + seriesName + '/ limit 1').then(function(data) {
if (!data) {
return [];
}
return data[0].columns;
});
};
......@@ -229,7 +232,7 @@ function (angular, _, kbn) {
datapoints[i] = [metricValue, groupPoints[i][timeCol]];
}
seriesName = alias ? alias : key;
seriesName = alias ? alias : series.name;
// if mulitple groups append key to alias
if (alias && groupByField) {
......
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