mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Added test connection action to all data sources, Closes #1997
This commit is contained in:
@@ -75,10 +75,19 @@ function (angular, config) {
|
||||
$scope.testing.title = 'Unknown';
|
||||
return;
|
||||
}
|
||||
|
||||
return datasource.testDatasource().then(function(result) {
|
||||
$scope.testing.message = result.message;
|
||||
$scope.testing.status = result.status;
|
||||
$scope.testing.title = result.title;
|
||||
}, function(err) {
|
||||
if (err.statusText) {
|
||||
$scope.testing.message = err.statusText;
|
||||
$scope.testing.title = "HTTP Error";
|
||||
} else {
|
||||
$scope.testing.message = err.message;
|
||||
$scope.testing.title = "Unknown error";
|
||||
}
|
||||
});
|
||||
}).finally(function() {
|
||||
$scope.testing.done = true;
|
||||
|
||||
@@ -199,16 +199,6 @@ function (angular, _, $, config, kbn, moment) {
|
||||
GraphiteDatasource.prototype.testDatasource = function() {
|
||||
return this.metricFindQuery('*').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 };
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -129,16 +129,6 @@ function (angular, _, kbn, InfluxSeries, InfluxQueryBuilder) {
|
||||
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 };
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -99,6 +99,12 @@ function (angular, _, kbn, InfluxSeries, InfluxQueryBuilder) {
|
||||
});
|
||||
};
|
||||
|
||||
InfluxDatasource.prototype.testDatasource = function() {
|
||||
return this.metricFindQuery('list series').then(function () {
|
||||
return { status: "success", message: "Data source is working", title: "Success" };
|
||||
});
|
||||
};
|
||||
|
||||
InfluxDatasource.prototype.metricFindQuery = function (query) {
|
||||
var interpolated;
|
||||
try {
|
||||
|
||||
@@ -90,6 +90,12 @@ function (angular, _, kbn) {
|
||||
});
|
||||
};
|
||||
|
||||
OpenTSDBDatasource.prototype.testDatasource = function() {
|
||||
return this.performSuggestQuery('cpu', 'metrics').then(function () {
|
||||
return { status: "success", message: "Data source is working", title: "Success" };
|
||||
});
|
||||
};
|
||||
|
||||
function transformMetricData(md, groupByTags, options) {
|
||||
var metricLabel = createMetricLabel(md, options, groupByTags);
|
||||
var dps = [];
|
||||
|
||||
Reference in New Issue
Block a user