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 to = Math.ceil(dateMath.parse(options.rangeRaw.to) / 1000);
|
||||||
var self = this;
|
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 = {
|
var params = {
|
||||||
output: ['triggerid', 'description'],
|
output: ['triggerid', 'description', 'priority'],
|
||||||
|
preservekeys: 1,
|
||||||
|
filter: { 'priority': severities },
|
||||||
search: {
|
search: {
|
||||||
'description': options.annotation.trigger
|
'description': options.annotation.trigger
|
||||||
},
|
},
|
||||||
@@ -359,7 +366,7 @@ function (angular, _, dateMath) {
|
|||||||
return this.zabbixAPI.performZabbixAPIRequest('trigger.get', params)
|
return this.zabbixAPI.performZabbixAPIRequest('trigger.get', params)
|
||||||
.then(function (result) {
|
.then(function (result) {
|
||||||
if(result) {
|
if(result) {
|
||||||
var objects = _.indexBy(result, 'triggerid');
|
var objects = result;
|
||||||
var params = {
|
var params = {
|
||||||
output: 'extend',
|
output: 'extend',
|
||||||
time_from: from,
|
time_from: from,
|
||||||
@@ -385,6 +392,9 @@ function (angular, _, dateMath) {
|
|||||||
title += Number(e.value) ? 'Problem' : 'OK';
|
title += Number(e.value) ? 'Problem' : 'OK';
|
||||||
|
|
||||||
_.each(result, function(e) {
|
_.each(result, function(e) {
|
||||||
|
// Hide acknowledged events
|
||||||
|
if (e.acknowledges.length > 0 && options.annotation.showAcknowledged) { return; }
|
||||||
|
|
||||||
var formatted_acknowledges = zabbixHelperSrv.formatAcknowledges(e.acknowledges);
|
var formatted_acknowledges = zabbixHelperSrv.formatAcknowledges(e.acknowledges);
|
||||||
events.push({
|
events.push({
|
||||||
annotation: options.annotation,
|
annotation: options.annotation,
|
||||||
|
|||||||
@@ -21,6 +21,11 @@
|
|||||||
</label>
|
</label>
|
||||||
<input type="text" style="width: 25em" ng-model='currentAnnotation.trigger' placeholder="Trigger name"></input>
|
<input type="text" style="width: 25em" ng-model='currentAnnotation.trigger' placeholder="Trigger name"></input>
|
||||||
</div>
|
</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>
|
||||||
|
|
||||||
<div class="editor-row">
|
<div class="editor-row">
|
||||||
@@ -38,5 +43,11 @@
|
|||||||
<label for="currentAnnotation.showHostname" class="cr1">Show hostname
|
<label for="currentAnnotation.showHostname" class="cr1">Show hostname
|
||||||
<tip>Show the hostname the event belongs to</tip>
|
<tip>Show the hostname the event belongs to</tip>
|
||||||
</label>
|
</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>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user