Lots of smaller fixes:

- Add the rotation_duration to the keys API
- Have the key service UI use the new rotation_duration field
- Fix notification deletion lookup path
- Add proper support for the new notification in the UI
- Only delete expired keys after 7 days (configurable)
- Fix angular digest loop
- Fix unit tests
- Regenerate initdb
This commit is contained in:
Joseph Schorr 2016-04-12 19:17:19 -04:00 committed by Jimmy Zelinskie
parent 2805dad64f
commit 522cf68c5d
12 changed files with 86 additions and 20 deletions

View file

@ -18,7 +18,8 @@ angular.module('quay').directive('datetimePicker', function () {
$element.find('input').datetimepicker({
'format': 'LLL',
'sideBySide': true,
'showClear': true
'showClear': true,
'minDate': new Date()
});
$element.find('input').on("dp.change", function (e) {

View file

@ -32,7 +32,9 @@ angular.module('quay').directive('serviceKeysManager', function () {
var keys = $scope.keys.map(function(key) {
var expiration_datetime = -Number.MAX_VALUE;
if (key.expiration_date) {
if (key.rotation_duration) {
expiration_datetime = -(Number.MAX_VALUE/2);
} else if (key.expiration_date) {
expiration_datetime = new Date(key.expiration_date).valueOf() * (-1);
}
@ -66,15 +68,19 @@ angular.module('quay').directive('serviceKeysManager', function () {
key.expanded = !key.expanded;
};
$scope.getRotationDate = function(key) {
return moment(key.created_date).add(key.rotation_duration, 's').format('LLL');
};
$scope.getExpirationInfo = function(key) {
if (!key.expiration_date) {
return '';
}
if (key.metadata.rotation_ttl) {
var rotate_date = moment(key.created_date).add(key.metadata.rotation_ttl, 's')
if (key.rotation_duration) {
var rotate_date = moment(key.created_date).add(key.rotation_duration, 's')
if (moment().isBefore(rotate_date)) {
return {'className': 'rotation', 'icon': 'fa-refresh', 'rotateDate': rotate_date};
return {'className': 'rotation', 'icon': 'fa-refresh', 'willRotate': true};
}
}