mysql-connector: test MySQL data source during ds config

This commit is contained in:
Alexander Zobnin
2017-07-25 13:02:59 +03:00
parent ffeaeab988
commit 4ec84b21e5
8 changed files with 86 additions and 17 deletions

View File

@@ -392,6 +392,12 @@ var ZabbixAPIDatasource = function () {
return this.zabbix.getVersion().then(function (version) {
zabbixVersion = version;
return _this5.zabbix.login();
}).then(function () {
if (_this5.enableDirectDBConnection) {
return _this5.zabbix.dbConnector.testSQLDataSource();
} else {
return Promise.resolve();
}
}).then(function () {
return {
status: "success",
@@ -405,6 +411,12 @@ var ZabbixAPIDatasource = function () {
title: error.message,
message: error.data
};
} else if (error.data && error.data.message) {
return {
status: "error",
title: "Connection failed",
message: error.data.message
};
} else {
return {
status: "error",