Add a severity and acknowledgement filter for annotations
Add a severity filter, much like it is present in various places in Zabbix, as well as a filter for the acknowledgement status. This brings the interface closer to what is asked for in https://support.zabbix.com/browse/ZBXNEXT-410
This commit is contained in:
@@ -341,8 +341,15 @@ function (angular, _, dateMath) {
|
||||
var to = Math.ceil(dateMath.parse(options.rangeRaw.to) / 1000);
|
||||
var self = this;
|
||||
|
||||
// Remove events below the chose severity
|
||||
var severities = [];
|
||||
for (var i = 5; i >= options.annotation.minseverity; i--) {
|
||||
severities.push(i);
|
||||
}
|
||||
var params = {
|
||||
output: ['triggerid', 'description'],
|
||||
output: ['triggerid', 'description', 'priority'],
|
||||
preservekeys: 1,
|
||||
filter: { 'priority': severities },
|
||||
search: {
|
||||
'description': options.annotation.trigger
|
||||
},
|
||||
@@ -359,7 +366,7 @@ function (angular, _, dateMath) {
|
||||
return this.zabbixAPI.performZabbixAPIRequest('trigger.get', params)
|
||||
.then(function (result) {
|
||||
if(result) {
|
||||
var objects = _.indexBy(result, 'triggerid');
|
||||
var objects = result;
|
||||
var params = {
|
||||
output: 'extend',
|
||||
time_from: from,
|
||||
@@ -385,6 +392,9 @@ function (angular, _, dateMath) {
|
||||
title += Number(e.value) ? 'Problem' : 'OK';
|
||||
|
||||
_.each(result, function(e) {
|
||||
// Hide acknowledged events
|
||||
if (e.acknowledges.length > 0 && options.annotation.showAcknowledged) { return; }
|
||||
|
||||
var formatted_acknowledges = zabbixHelperSrv.formatAcknowledges(e.acknowledges);
|
||||
events.push({
|
||||
annotation: options.annotation,
|
||||
|
||||
@@ -21,6 +21,11 @@
|
||||
</label>
|
||||
<input type="text" style="width: 25em" ng-model='currentAnnotation.trigger' placeholder="Trigger name"></input>
|
||||
</div>
|
||||
<div class="editor-option">
|
||||
<label class="small">Minimum severity
|
||||
</label>
|
||||
<select class="small" style="width: 113px" ng-init='currentAnnotation.minseverity = currentAnnotation.minseverity || 0' ng-model='currentAnnotation.minseverity' ng-options="v as k for (k, v) in {'Not classified': 0, 'Information': 1, 'Warning': 2, 'Average': 3, 'High': 4, 'Disaster': 5}" ng-change="render()"></select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="editor-row">
|
||||
@@ -38,5 +43,11 @@
|
||||
<label for="currentAnnotation.showHostname" class="cr1">Show hostname
|
||||
<tip>Show the hostname the event belongs to</tip>
|
||||
</label>
|
||||
<input type="checkbox" class="cr1" id="currentAnnotation.showAcknowledged"
|
||||
ng-model="currentAnnotation.showAcknowledged"
|
||||
ng-checked="currentAnnotation.showAcknowledged">
|
||||
<label for="currentAnnotation.showAcknowledged" class="cr1">Hide acknowledged events
|
||||
<tip>Hide events, that have been acknowledged</tip>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user