Fix tag-specific-image-view when moving a tag within its own ancestor path

This commit is contained in:
Joseph Schorr 2014-08-13 18:47:07 -04:00
parent e7daca5d95
commit 61bde6bb90
2 changed files with 10 additions and 5 deletions

View file

@ -5416,7 +5416,8 @@ quayApp.directive('tagSpecificImagesView', function () {
scope: {
'repository': '=repository',
'tag': '=tag',
'images': '=images'
'images': '=images',
'imageCutoff': '=imageCutoff'
},
controller: function($scope, $element) {
$scope.getFirstTextLine = getFirstTextLine;
@ -5438,7 +5439,7 @@ quayApp.directive('tagSpecificImagesView', function () {
return classes;
};
var forAllTagImages = function(tag, callback) {
var forAllTagImages = function(tag, callback, opt_cutoff) {
if (!tag) { return; }
if (!$scope.imageByDBID) {
@ -5456,10 +5457,14 @@ quayApp.directive('tagSpecificImagesView', function () {
callback(tag_image);
var ancestors = tag_image.ancestors.split('/');
var ancestors = tag_image.ancestors.split('/').reverse();
for (var i = 0; i < ancestors.length; ++i) {
var image = $scope.imageByDBID[ancestors[i]];
if (image) {
if (image == opt_cutoff) {
return;
}
callback(image);
}
}
@ -5481,7 +5486,7 @@ quayApp.directive('tagSpecificImagesView', function () {
var ids = {};
forAllTagImages(currentTag, function(image) {
ids[image.dbid] = true;
});
}, $scope.imageCutoff);
return ids;
};

View file

@ -367,7 +367,7 @@
<div style="margin: 10px; margin-top: 20px;" ng-show="isAnotherImageTag(toTagImage, tagToCreate)">
Note: <span class="label tag label-default">{{ tagToCreate }}</span> is already applied to another image. This will <b>move</b> the tag.
</div>
<div class="tag-specific-images-view" tag="tagToCreate" repository="repo" images="images"
<div class="tag-specific-images-view" tag="tagToCreate" repository="repo" images="images" image-cutoff="toTagImage"
style="margin: 10px; margin-top: 20px; margin-bottom: -10px;" ng-show="isAnotherImageTag(toTagImage, tagToCreate)">
This will also delete any unattach images and delete the following images:
</div>