Filter entire groups of non-selected destionations
This commit is contained in:
parent
fa64b7d1b9
commit
f915a61d16
|
@ -172,6 +172,17 @@ angular.module('am.controllers').controller('AlertsCtrl',
|
|||
$scope.groups = null;
|
||||
$scope.allDestinations = [];
|
||||
|
||||
$scope.notEmpty = function(group) {
|
||||
var l = 0;
|
||||
angular.forEach(group.groups, function(g) {
|
||||
if ($scope.destinations.indexOf(g.routeOpts.sendTo) >= 0) {
|
||||
l += g.alerts.length;
|
||||
}
|
||||
});
|
||||
|
||||
return l > 0;
|
||||
};
|
||||
|
||||
$scope.refresh = function() {
|
||||
AlertGroups.query({},
|
||||
function(data) {
|
||||
|
@ -366,7 +377,7 @@ angular.module('am').config(
|
|||
controller: 'StatusCtrl'
|
||||
}).
|
||||
otherwise({
|
||||
redirectTo: '/silences'
|
||||
redirectTo: '/alerts'
|
||||
});
|
||||
}
|
||||
);
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<div class="right">
|
||||
<div ng-show="alert.inhibited" class="left lbl muted-lbl">inhibited</div>
|
||||
<div ng-show="alert.silenced" class="left lbl muted-lbl"><a ng-href="/#/silences?hl={{ alert.silenced }}">silenced</div>
|
||||
<div ng-show="alert.silenced" class="left lbl muted-lbl"><a ng-href="/#/silences?hl={{ alert.silenced }}">silenced</a></div>
|
||||
|
||||
<button type="black" disabled small>Since {{ alert.startsAt | amCalendar }}</button>
|
||||
<button class="silence-button" type="secondary" ng-click="toggleSilenceForm()" small upper>Silence</button>
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
<div>
|
||||
<fieldset id="silence-create">
|
||||
<legend>Filter</legend>
|
||||
<select class="select" ng-model="destinations" multiple>
|
||||
<option ng-repeat="dest in allDestinations" value="{{ dest }}">{{ dest }}</option>
|
||||
</select>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<div id="alert-groups" ng-controller="AlertsCtrl">
|
||||
<div class="alert-group" ng-repeat="group in groups">
|
||||
<div class="alert-group" ng-repeat="group in groups | filter:notEmpty">
|
||||
<div class="alert-group-header group">
|
||||
<span ng-repeat="(ln, lv) in group.labels" class="lbl {{ ln == 'alertname' ? 'lbl-highlight' : '' }}">
|
||||
{{ ln }} = '{{ lv }}'
|
||||
|
|
Loading…
Reference in New Issue