InfluxDB Filters: added function to generate filter list.

parent 2b5e9741
...@@ -8,7 +8,7 @@ function (angular, _, kbn) { ...@@ -8,7 +8,7 @@ function (angular, _, kbn) {
var module = angular.module('kibana.services'); var module = angular.module('kibana.services');
module.factory('InfluxDatasource', function($q, $http) { module.factory('InfluxDatasource', function($q, $http, filterSrv) {
function InfluxDatasource(datasource) { function InfluxDatasource(datasource) {
this.type = 'influxDB'; this.type = 'influxDB';
...@@ -110,6 +110,26 @@ function (angular, _, kbn) { ...@@ -110,6 +110,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) { function retry(deferred, callback, delay) {
return callback().then(undefined, function(reason) { return callback().then(undefined, function(reason) {
if (reason.status !== 0) { if (reason.status !== 0) {
......
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