Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
HAWKULAR-306: Add resolve all button
Browse files Browse the repository at this point in the history
  • Loading branch information
Viliam Rockai committed Jun 3, 2015
1 parent 46cef5d commit 3007d53
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ <h1>No alerts.</h1>
<p class="pull-right"><strong>{{(mac.alertList | filter:timeFilter).length}} alerts</strong> last week.</p>
</div>
-->

<div class="clearfix">
<div ng-repeat="alert in mac.alertList | filter:timeFilter | orderBy: '-start'">

Expand Down Expand Up @@ -75,8 +74,10 @@ <h1>No alerts.</h1>
</a>
</div>
</div>

</div>


</div>
<div class="clearfix" ng-show="mac.alertList.length > 0">
<button class="btn btn-danger pull-right" ng-click="mac.resolveAll()" ng-disabled="mac.isResolvingAll">
<span class="fa fa-check-square-o" style="color:white"></span>
Resolve all</button>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ module HawkularMetrics {
private metricId: string;
public alertList: any = [];
public openSetup: any;
public isResolvingAll: boolean = false;

constructor(private $scope:any,
private HawkularAlert:any,
Expand Down Expand Up @@ -90,6 +91,20 @@ module HawkularMetrics {
}
}

public resolveAll(): void {
this.isResolvingAll = true;
var alertIdList = '';
for (var i = 0; i < this.alertList.length; i++) {
alertIdList = alertIdList + this.alertList[i].id + ',';
}
alertIdList = alertIdList.slice(0, - 1);

this.HawkularAlert.Alert.resolve({alertIds: alertIdList}, {}).$promise.then( () => {
this.alertList.length = 0;
this.isResolvingAll = false;
});
}

}

_module.controller('MetricsAlertController', MetricsAlertController);
Expand Down

0 comments on commit 3007d53

Please sign in to comment.