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

@@ -318,6 +318,13 @@ class ZabbixAPIDatasource {
zabbixVersion = version;
return this.zabbix.login();
})
.then(() => {
if (this.enableDirectDBConnection) {
return this.zabbix.dbConnector.testSQLDataSource();
} else {
return Promise.resolve();
}
})
.then(() => {
return {
status: "success",
@@ -332,6 +339,12 @@ class ZabbixAPIDatasource {
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",