Hide groups if all alerts within are silenced

Currently, even if all alerts within a group are silenced, the group
summary still appears. This can take up a lot of space when many alerts
are silenced.

If all alerts in a group are silenced and 'Hide silences' is checked,
hide the empty group.

bindata was updated by running:

    make assets format
This commit is contained in:
Matt Bostock 2016-07-16 00:13:47 +01:00
parent 5b64baa419
commit 16d8afd5a8
3 changed files with 32 additions and 28 deletions

View File

@ -83,7 +83,7 @@ func templateDefaultTmpl() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "template/default.tmpl", size: 16200, mode: os.FileMode(420), modTime: time.Unix(1469559122, 0)}
info := bindataFileInfo{name: "template/default.tmpl", size: 16200, mode: os.FileMode(420), modTime: time.Unix(1469708853, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}

View File

@ -184,14 +184,18 @@ angular.module('am.controllers').controller('AlertsCtrl',
});
$scope.notEmpty = function(group) {
var l = 0;
var ret = false
angular.forEach(group.blocks, function(blk) {
if (this.indexOf(blk.routeOpts.receiver) >= 0) {
l += blk.alerts.length || 0;
var unsilencedAlerts = blk.alerts.filter(function (a) { return !a.silenced; });
if (!$scope.hideSilenced && blk.alerts.length > 0 || $scope.hideSilenced && unsilencedAlerts.length > 0) {
ret = true
}
}
}, $scope.receivers);
return l > 0;
return ret;
};
$scope.refresh = function() {

File diff suppressed because one or more lines are too long