Have tag ops dialog set the expiration date to the current date for the tag, by default

This commit is contained in:
Joseph Schorr 2017-06-27 14:15:33 +03:00
parent 1d600abc5d
commit a8b340feb6
2 changed files with 7 additions and 3 deletions

View file

@ -126,7 +126,8 @@
</ul> </ul>
<label style="margin-top: 20px;">Expiration Date:</label> <label style="margin-top: 20px;">Expiration Date:</label>
<span class="datetime-picker" datetime="changeTagsExpirationInfo.expiration_date"></span> <span class="datetime-picker" datetime="changeTagsExpirationInfo.expiration_date"
ng-if="changeTagsExpirationInfo"></span>
<span class="co-help-text"> <span class="co-help-text">
If specified, the date and time that the key expires. If set to none, the tag(s) will not expire. If specified, the date and time that the key expires. If set to none, the tag(s) will not expire.
</span> </span>

View file

@ -18,6 +18,7 @@ angular.module('quay').directive('tagOperationsDialog', function () {
}, },
controller: function($scope, $element, $timeout, ApiService) { controller: function($scope, $element, $timeout, ApiService) {
$scope.addingTag = false; $scope.addingTag = false;
$scope.changeTagsExpirationInfo = null;
var markChanged = function(added, removed) { var markChanged = function(added, removed) {
// Reload the repository. // Reload the repository.
@ -346,9 +347,11 @@ angular.module('quay').directive('tagOperationsDialog', function () {
return; return;
} }
$scope.changeTagsExpirationInfo ={ var expiration_date = null;
expiration_date = tags[0].expiration_date ? tags[0].expiration_date / 1000 : null;
$scope.changeTagsExpirationInfo = {
'tags': tags, 'tags': tags,
'expiration_date': null 'expiration_date': expiration_date
}; };
}, },