|
@@ -126,6 +126,22 @@ function (angular, _, kbn, InfluxSeries, InfluxQueryBuilder) {
|
|
|
return this._influxRequest('GET', '/query', {q: query});
|
|
return this._influxRequest('GET', '/query', {q: query});
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ InfluxDatasource.prototype.testDatasource = function() {
|
|
|
|
|
+ return this.metricFindQuery('SHOW MEASUREMENTS LIMIT 1').then(function () {
|
|
|
|
|
+ return { status: "success", message: "Data source is working", title: "Success" };
|
|
|
|
|
+ }, function(err) {
|
|
|
|
|
+ var message, title;
|
|
|
|
|
+ if (err.statusText) {
|
|
|
|
|
+ message = err.statusText;
|
|
|
|
|
+ title = "HTTP Error";
|
|
|
|
|
+ } else {
|
|
|
|
|
+ message = err;
|
|
|
|
|
+ title = "Unknown error";
|
|
|
|
|
+ }
|
|
|
|
|
+ return { status: "error", message: message, title: title };
|
|
|
|
|
+ });
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
InfluxDatasource.prototype._influxRequest = function(method, url, data) {
|
|
InfluxDatasource.prototype._influxRequest = function(method, url, data) {
|
|
|
var self = this;
|
|
var self = this;
|
|
|
var deferred = $q.defer();
|
|
var deferred = $q.defer();
|