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:
parent
2805dad64f
commit
522cf68c5d
12 changed files with 86 additions and 20 deletions
|
@ -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) {
|
||||
|
|
|
@ -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};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -131,6 +131,42 @@ function($rootScope, $interval, UserService, ApiService, StringBuilderService, P
|
|||
return '/repository/' + metadata.repository + '?tab=tags';
|
||||
},
|
||||
'dismissable': true
|
||||
},
|
||||
'service_key_submitted': {
|
||||
'level': 'primary',
|
||||
'message': 'Service key {kid} for service {service} requests approval<br><br>Key was created on {created_date}',
|
||||
'actions': [
|
||||
{
|
||||
'title': 'Approve Key',
|
||||
'kind': 'primary',
|
||||
'handler': function(notification) {
|
||||
var params = {
|
||||
'kid': notification.metadata.kid
|
||||
};
|
||||
|
||||
ApiService.approveServiceKey({}, params).then(function(resp) {
|
||||
notificationService.update();
|
||||
window.location = '/superuser/?tab=servicekeys';
|
||||
}, ApiService.errorDisplay('Could not approve service key'));
|
||||
}
|
||||
},
|
||||
{
|
||||
'title': 'Delete Key',
|
||||
'kind': 'default',
|
||||
'handler': function(notification) {
|
||||
var params = {
|
||||
'kid': notification.metadata.kid
|
||||
};
|
||||
|
||||
ApiService.deleteServiceKey(null, params).then(function(resp) {
|
||||
notificationService.update();
|
||||
}, ApiService.errorDisplay('Could not delete service key'));
|
||||
}
|
||||
}
|
||||
],
|
||||
'page': function(metadata) {
|
||||
return '/superuser/?tab=servicekeys';
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -44,6 +44,10 @@ angular.module('quay').factory('StringBuilderService', ['$sce', 'UtilService', f
|
|||
return metadata.kid.substr(0, 12);
|
||||
},
|
||||
|
||||
'created_date': function(value) {
|
||||
return moment.unix(value).format('LLL');
|
||||
},
|
||||
|
||||
'expiration_date': function(value) {
|
||||
return moment.unix(value).format('LLL');
|
||||
},
|
||||
|
|
Reference in a new issue