Fix add tag operation in UI on manifests without legacy images

This commit is contained in:
Joseph Schorr 2018-11-20 14:01:35 +02:00
parent a6ffad9759
commit 1e4e424d64
4 changed files with 43 additions and 14 deletions

View file

@ -92,6 +92,10 @@ angular.module('quay').directive('repoPanelTags', function () {
var imageIndexMap = {};
for (var i = 0; i < ordered.length; ++i) {
var tagInfo = ordered[i];
if (!tagInfo.image_id) {
continue;
}
if (!imageMap[tagInfo.image_id]) {
imageMap[tagInfo.image_id] = [];
imageIDs.push(tagInfo.image_id)
@ -360,7 +364,7 @@ angular.module('quay').directive('repoPanelTags', function () {
};
$scope.askAddTag = function(tag) {
$scope.tagActionHandler.askAddTag(tag.image_id);
$scope.tagActionHandler.askAddTag(tag.image_id, tag.manifest_digest);
};
$scope.showLabelEditor = function(tag) {

View file

@ -84,7 +84,7 @@ angular.module('quay').directive('tagOperationsDialog', function () {
return found.image_id == image;
};
$scope.createOrMoveTag = function(image, tag) {
$scope.createOrMoveTag = function(image, tag, opt_manifest_digest) {
if (!$scope.repository.can_write) { return; }
if ($scope.alertOnTagOpsDisabled()) {
return;
@ -97,9 +97,14 @@ angular.module('quay').directive('tagOperationsDialog', function () {
'tag': tag
};
var data = {
'image': image
};
var data = {};
if (image) {
data['image'] = image;
}
if (opt_manifest_digest) {
data['manifest_digest'] = opt_manifest_digest;
}
var errorHandler = ApiService.errorDisplay('Cannot create or move tag', function(resp) {
$element.find('#createOrMoveTagModal').modal('hide');
@ -330,13 +335,14 @@ angular.module('quay').directive('tagOperationsDialog', function () {
};
},
'askAddTag': function(image) {
'askAddTag': function(image, opt_manifest_digest) {
if ($scope.alertOnTagOpsDisabled()) {
return;
}
$scope.tagToCreate = '';
$scope.toTagImage = image;
$scope.toTagManifestDigest = opt_manifest_digest;
$scope.addingTag = false;
$scope.addTagForm.$setPristine();
$element.find('#createOrMoveTagModal').modal('show');