Merge branch 'develop'

This commit is contained in:
Alexander Zobnin
2016-09-24 14:02:49 +03:00
7 changed files with 134 additions and 21 deletions

View File

@@ -41,12 +41,12 @@ function ZabbixAPIService($q, alertSrv, zabbixAPICoreService) {
request(method, params) {
var self = this;
return this.zabbixAPICore.request(this.url, method, params, this.requestOptions, this.auth)
.then(function(result) {
return this.zabbixAPICore
.request(this.url, method, params, this.requestOptions, this.auth)
.then((result) => {
return result;
},
// Handle API errors
function(error) {
}, (error) => {
// Handle API errors
if (isNotAuthorized(error.data)) {
return self.loginOnce().then(
function() {
@@ -56,15 +56,18 @@ function ZabbixAPIService($q, alertSrv, zabbixAPICoreService) {
function(error) {
self.alertAPIError(error.data);
});
} else {
this.alertSrv.set("Connection Error", error.data, 'error', 5000);
}
});
}
alertAPIError(message) {
alertAPIError(message, timeout = 5000) {
this.alertSrv.set(
"Zabbix API Error",
message,
'error'
'error',
timeout
);
}