refactor: collapse options in getTriggers()
This commit is contained in:
@@ -346,13 +346,15 @@ class ZabbixAPIDatasource {
|
||||
var showOkEvents = annotation.showOkEvents ? c.SHOW_ALL_EVENTS : c.SHOW_OK_EVENTS;
|
||||
|
||||
// Show all triggers
|
||||
var showTriggers = c.SHOW_ALL_TRIGGERS;
|
||||
let triggersOptions = {
|
||||
showTriggers: c.SHOW_ALL_TRIGGERS,
|
||||
hideHostsInMaintenance: false
|
||||
};
|
||||
|
||||
var getTriggers = this.zabbix
|
||||
.getTriggers(this.replaceTemplateVars(annotation.group, {}),
|
||||
this.replaceTemplateVars(annotation.host, {}),
|
||||
this.replaceTemplateVars(annotation.application, {}),
|
||||
showTriggers);
|
||||
var getTriggers = this.zabbix.getTriggers(this.replaceTemplateVars(annotation.group, {}),
|
||||
this.replaceTemplateVars(annotation.host, {}),
|
||||
this.replaceTemplateVars(annotation.application, {}),
|
||||
triggersOptions);
|
||||
|
||||
return getTriggers.then(triggers => {
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ function ZabbixFactory(zabbixAPIService, ZabbixCachingProxy) {
|
||||
/**
|
||||
* Build query - convert target filters to array of Zabbix items
|
||||
*/
|
||||
getTriggers(groupFilter, hostFilter, appFilter, showTriggers, hideHostsInMaintenance) {
|
||||
getTriggers(groupFilter, hostFilter, appFilter, options) {
|
||||
let promises = [
|
||||
this.getGroups(groupFilter),
|
||||
this.getHosts(groupFilter, hostFilter),
|
||||
@@ -163,8 +163,7 @@ function ZabbixFactory(zabbixAPIService, ZabbixCachingProxy) {
|
||||
|
||||
return query;
|
||||
}).then(query => {
|
||||
return this.zabbixAPI
|
||||
.getTriggers(query.groupids, query.hostids, query.applicationids, showTriggers, hideHostsInMaintenance);
|
||||
return this.zabbixAPI.getTriggers(query.groupids, query.hostids, query.applicationids, options);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -334,8 +334,10 @@ function ZabbixAPIServiceFactory(alertSrv, zabbixAPICoreService) {
|
||||
return this.request('service.getsla', params);
|
||||
}
|
||||
|
||||
getTriggers(groupids, hostids, applicationids, showTriggers, hideHostsInMaintenance, timeFrom, timeTo) {
|
||||
var params = {
|
||||
getTriggers(groupids, hostids, applicationids, options) {
|
||||
let {showTriggers, hideHostsInMaintenance, timeFrom, timeTo} = options;
|
||||
|
||||
let params = {
|
||||
output: 'extend',
|
||||
groupids: groupids,
|
||||
hostids: hostids,
|
||||
|
||||
Reference in New Issue
Block a user