ui: split silences into pending/elapsed/active

This commit is contained in:
Fabian Reinartz 2016-06-24 16:32:35 +02:00
parent c0103dd8c6
commit 1e5babd843
3 changed files with 29 additions and 15 deletions

View File

@ -298,13 +298,20 @@ angular.module('am.controllers').controller('SilencesCtrl',
$scope.refresh(); $scope.refresh();
}); });
$scope.elapsed = function(elapsed) { $scope.elapsed = function() {
return function(sil) { return function(sil) {
if (elapsed) { return sil.endsAt < new Date;
return sil.endsAt <= new Date; };
} };
return sil.endsAt > new Date; $scope.pending = function() {
} return function(sil) {
return sil.startsAt > new Date;
};
};
$scope.active = function() {
return function(sil) {
return sil.startsAt <= new Date;
};
}; };
$scope.refresh(); $scope.refresh();

View File

@ -29,15 +29,22 @@
<div class="active-silences"> <div class="active-silences">
<h4 class="thin">Active</h4> <h4 class="thin">Active</h4>
<div class="list-item group" ng-repeat="sil in silences | filter:query | filter:elapsed(false) | orderBy:order"> <div class="list-item group" ng-repeat="sil in silences | filter:query | filter:active() | orderBy:order">
<silence sil="sil"></silence>
</div>
</div>
<div class="pending-silences">
<h4 class="thin">Pending</h4>
<div class="list-item group" ng-repeat="sil in silences | filter:query | filter:pending() | orderBy:order">
<silence sil="sil"></silence> <silence sil="sil"></silence>
</div> </div>
</div> </div>
<div class="elapsed-silences"> <div class="elapsed-silences">
<h4 class="thin">Elapsed</h4> <h4 class="thin">Elapsed</h4>
<div class="list-item group" ng-repeat="sil in silences | filter:query | filter:elapsed(true) | orderBy:order"> <div class="list-item group" ng-repeat="sil in silences | filter:query | filter:elapsed() | orderBy:order">
<silence sil="sil"></silence> <silence sil="sil"></silence>
</div> </div>
</div> </div>
</div> </div>

File diff suppressed because one or more lines are too long