mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge branch 'feature/influxdb-filters' of github.com:mavimo/grafana into mavimo-feature/influxdb-filters
This commit is contained in:
commit
2a261a32e2
@ -8,7 +8,7 @@ function (angular, _, kbn) {
|
||||
|
||||
var module = angular.module('kibana.services');
|
||||
|
||||
module.factory('InfluxDatasource', function($q, $http) {
|
||||
module.factory('InfluxDatasource', function($q, $http, filterSrv) {
|
||||
|
||||
function InfluxDatasource(datasource) {
|
||||
this.type = 'influxDB';
|
||||
@ -59,6 +59,7 @@ function (angular, _, kbn) {
|
||||
}
|
||||
|
||||
query = queryElements.join(" ");
|
||||
query = filterSrv.applyFilterToTarget(query);
|
||||
}
|
||||
else {
|
||||
var template = "select [[func]](\"[[column]]\") as \"[[column]]_[[func]]\" from \"[[series]]\" " +
|
||||
@ -78,6 +79,7 @@ function (angular, _, kbn) {
|
||||
};
|
||||
|
||||
query = _.template(template, templateData, this.templateSettings);
|
||||
query = filterSrv.applyFilterToTarget(query);
|
||||
target.query = query;
|
||||
}
|
||||
|
||||
@ -109,6 +111,26 @@ function (angular, _, kbn) {
|
||||
});
|
||||
};
|
||||
|
||||
InfluxDatasource.prototype.metricFindQuery = function (query) {
|
||||
var interpolated;
|
||||
try {
|
||||
interpolated = filterSrv.applyFilterToTarget(query);
|
||||
}
|
||||
catch(err) {
|
||||
return $q.reject(err);
|
||||
}
|
||||
|
||||
return this.doInfluxRequest(query, 'filters')
|
||||
.then(function (results) {
|
||||
return _.map(results[0].points, function (metric) {
|
||||
return {
|
||||
text: metric[1],
|
||||
expandable: false
|
||||
};
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
function retry(deferred, callback, delay) {
|
||||
return callback().then(undefined, function(reason) {
|
||||
if (reason.status !== 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user