UI changes - Button to show / hide expired certs.

This commit is contained in:
Kush Bavishi 2019-06-20 15:04:40 -07:00
parent f836c6fff6
commit 68815b8f44
2 changed files with 36 additions and 0 deletions

View File

@ -19,6 +19,9 @@ angular.module('lemur')
.controller('CertificatesViewController', function ($q, $scope, $uibModal, $stateParams, $location, CertificateApi, CertificateService, MomentService, ngTableParams, toaster) {
$scope.filter = $stateParams;
$scope.expiredText = ["Show Expired", "Hide Expired"];
$scope.expiredValue = 0;
$scope.expiredButton = $scope.expiredText[$scope.expiredValue];
$scope.certificateTable = new ngTableParams({
page: 1, // show first page
count: 10, // count per page
@ -50,6 +53,34 @@ angular.module('lemur')
}
});
$scope.showExpired = function () {
if ($scope.expiredValue === 0) {
$scope.expiredValue = 1;
}
else {
$scope.expiredValue = 0;
}
$scope.expiredButton = $scope.expiredText[$scope.expiredValue];
$scope.certificateTable = new ngTableParams({
page: 1, // show first page
count: 10, // count per page
sorting: {
id: 'desc' // initial sorting
},
filter: $scope.filter
}, {
getData: function ($defer, params) {
$scope.temp = angular.copy(params.url());
$scope.temp.showExpired = $scope.expiredValue;
CertificateApi.getList($scope.temp)
.then(function (data) {
params.total(data.total);
$defer.resolve(data);
});
}
})
};
$scope.momentService = MomentService;
$scope.remove = function (certificate) {

View File

@ -17,6 +17,11 @@
btn-checkbox-true="1"
btn-checkbox-false="0">Filter</button>
</div>
<div class="btn-group">
<button ng-click="showExpired()" class="btn btn-default">
{{ expiredButton }}
</button>
</div>
<!--<select class="form-control" ng-model="show" ng-options="item.value as item.title for item in fields"></select>-->
<div class="clearfix"></div>
</div>