Fixed triggers filtering by value (All, OK, Problems).

This commit is contained in:
Alexander Zobnin
2016-03-30 20:33:50 +03:00
parent 8e44587594
commit 14d8caf61e
4 changed files with 13 additions and 10 deletions

View File

@@ -343,6 +343,9 @@ export class ZabbixAPIDatasource {
var self = this; var self = this;
var showOkEvents = annotation.showOkEvents ? [0, 1] : 1; var showOkEvents = annotation.showOkEvents ? [0, 1] : 1;
// Show all triggers
var showTriggers = [0, 1];
var buildQuery = self.queryProcessor.buildTriggerQuery(this.templateSrv.replace(annotation.group), var buildQuery = self.queryProcessor.buildTriggerQuery(this.templateSrv.replace(annotation.group),
this.templateSrv.replace(annotation.host), this.templateSrv.replace(annotation.host),
this.templateSrv.replace(annotation.application)); this.templateSrv.replace(annotation.application));
@@ -350,7 +353,7 @@ export class ZabbixAPIDatasource {
return self.zabbixAPI.getTriggers(query.groupids, return self.zabbixAPI.getTriggers(query.groupids,
query.hostids, query.hostids,
query.applicationids, query.applicationids,
true) showTriggers)
.then(function(triggers) { .then(function(triggers) {
// Filter triggers by description // Filter triggers by description

View File

@@ -298,7 +298,7 @@ function ZabbixAPIService($q, alertSrv, zabbixAPICoreService) {
return this.request('service.getsla', params); return this.request('service.getsla', params);
} }
getTriggers(groupids, hostids, applicationids, showAll) { getTriggers(groupids, hostids, applicationids, showTriggers) {
var params = { var params = {
output: 'extend', output: 'extend',
groupids: groupids, groupids: groupids,
@@ -318,14 +318,14 @@ function ZabbixAPIService($q, alertSrv, zabbixAPICoreService) {
selectLastEvent: 'extend' selectLastEvent: 'extend'
}; };
if (showAll) { if (showTriggers) {
params.filter = {}; params.filter.value = showTriggers;
} }
return this.request('trigger.get', params); return this.request('trigger.get', params);
} }
getEvents(objectids, from, to, showOkEvents) { getEvents(objectids, from, to, showEvents) {
var params = { var params = {
output: 'extend', output: 'extend',
time_from: from, time_from: from,
@@ -333,7 +333,7 @@ function ZabbixAPIService($q, alertSrv, zabbixAPICoreService) {
objectids: objectids, objectids: objectids,
select_acknowledges: 'extend', select_acknowledges: 'extend',
selectHosts: 'extend', selectHosts: 'extend',
value: showOkEvents value: showEvents
}; };
return this.request('event.get', params); return this.request('event.get', params);

View File

@@ -44,9 +44,9 @@ class TriggerPanelEditorCtrl{
]; ];
this.showEventsFields = [ this.showEventsFields = [
{ text: 'all events', value: [0,1] }, { text: 'All', value: [0,1] },
{ text: 'Ok events', value: 0 }, { text: 'OK', value: [0] },
{ text: 'Problem events', value: 1 } { text: 'Problems', value: 1 }
]; ];
// Load scope defaults // Load scope defaults

View File

@@ -43,7 +43,7 @@ var panelDefaults = {
limit: 10, limit: 10,
showTriggers: 'all triggers', showTriggers: 'all triggers',
sortTriggersBy: { text: 'last change', value: 'lastchange' }, sortTriggersBy: { text: 'last change', value: 'lastchange' },
showEvents: { text: 'Problem events', value: '1' }, showEvents: { text: 'Problems', value: '1' },
triggerSeverity: defaultSeverity, triggerSeverity: defaultSeverity,
okEventColor: 'rgba(0, 245, 153, 0.45)', okEventColor: 'rgba(0, 245, 153, 0.45)',
}; };