Switch to using straight docker IDs instead of a hashing scheme
This commit is contained in:
		
							parent
							
								
									63628678b8
								
							
						
					
					
						commit
						a90aab4665
					
				
					 8 changed files with 51 additions and 54 deletions
				
			
		|  | @ -5757,7 +5757,7 @@ quayApp.directive('tagSpecificImagesView', function () { | |||
|         } | ||||
|   | ||||
|         var currentTag = $scope.repository.tags[$scope.tag]; | ||||
|         if (image.internal_id == currentTag.internal_id) { | ||||
|         if (image.id == currentTag.image_id) { | ||||
|           classes += 'tag-image '; | ||||
|         } | ||||
|          | ||||
|  | @ -5767,15 +5767,15 @@ quayApp.directive('tagSpecificImagesView', function () { | |||
|       var forAllTagImages = function(tag, callback, opt_cutoff) { | ||||
|         if (!tag) { return; } | ||||
| 
 | ||||
|         if (!$scope.imageByInternalId) { | ||||
|           $scope.imageByInternalId = []; | ||||
|         if (!$scope.imageByDockerId) { | ||||
|           $scope.imageByDockerId = []; | ||||
|           for (var i = 0; i < $scope.images.length; ++i) { | ||||
|             var currentImage = $scope.images[i]; | ||||
|             $scope.imageByInternalId[currentImage.internal_id] = currentImage; | ||||
|             $scope.imageByDockerId[currentImage.id] = currentImage; | ||||
|           } | ||||
|         } | ||||
| 
 | ||||
|         var tag_image = $scope.imageByInternalId[tag.internal_id]; | ||||
|         var tag_image = $scope.imageByDockerId[tag.image_id]; | ||||
|         if (!tag_image) { | ||||
|           return; | ||||
|         } | ||||
|  | @ -5784,7 +5784,7 @@ quayApp.directive('tagSpecificImagesView', function () { | |||
| 
 | ||||
|         var ancestors = tag_image.ancestors.split('/').reverse(); | ||||
|         for (var i = 0; i < ancestors.length; ++i) { | ||||
|           var image = $scope.imageByInternalId[ancestors[i]]; | ||||
|           var image = $scope.imageByDockerId[ancestors[i]]; | ||||
|           if (image) { | ||||
|             if (image == opt_cutoff) { | ||||
|               return; | ||||
|  | @ -5810,7 +5810,7 @@ quayApp.directive('tagSpecificImagesView', function () { | |||
|         var getIdsForTag = function(currentTag) { | ||||
|           var ids = {}; | ||||
|           forAllTagImages(currentTag, function(image) { | ||||
|             ids[image.internal_id] = true; | ||||
|             ids[image.id] = true; | ||||
|           }, $scope.imageCutoff); | ||||
|           return ids; | ||||
|         }; | ||||
|  | @ -5820,8 +5820,8 @@ quayApp.directive('tagSpecificImagesView', function () { | |||
|         for (var currentTagName in $scope.repository.tags) { | ||||
|           var currentTag = $scope.repository.tags[currentTagName]; | ||||
|           if (currentTag != tag) { | ||||
|             for (var internal_id in getIdsForTag(currentTag)) { | ||||
|               delete toDelete[internal_id]; | ||||
|             for (var id in getIdsForTag(currentTag)) { | ||||
|               delete toDelete[id]; | ||||
|             } | ||||
|           } | ||||
|         } | ||||
|  | @ -5830,7 +5830,7 @@ quayApp.directive('tagSpecificImagesView', function () { | |||
|         var images = []; | ||||
|         for (var i = 0; i < $scope.images.length; ++i) { | ||||
|           var image = $scope.images[i]; | ||||
|           if (toDelete[image.internal_id]) { | ||||
|           if (toDelete[image.id]) { | ||||
|             images.push(image); | ||||
|           } | ||||
|         } | ||||
|  |  | |||
|  | @ -493,7 +493,7 @@ function RepoCtrl($scope, $sanitize, Restangular, ImageMetadataService, ApiServi | |||
|   }; | ||||
| 
 | ||||
|   $scope.findImageForTag = function(tag) { | ||||
|     return tag && $scope.imageByInternalId && $scope.imageByInternalId[tag.internal_id]; | ||||
|     return tag && $scope.imageByDockerId && $scope.imageByDockerId[tag.image_id]; | ||||
|   }; | ||||
| 
 | ||||
|   $scope.createOrMoveTag = function(image, tagName, opt_invalid) { | ||||
|  | @ -681,9 +681,9 @@ function RepoCtrl($scope, $sanitize, Restangular, ImageMetadataService, ApiServi | |||
|   }; | ||||
| 
 | ||||
|   var forAllTagImages = function(tag, callback) { | ||||
|     if (!tag || !$scope.imageByInternalId) { return; } | ||||
|     if (!tag || !$scope.imageByDockerId) { return; } | ||||
| 
 | ||||
|     var tag_image =  $scope.imageByInternalId[tag.internal_id]; | ||||
|     var tag_image =  $scope.imageByDockerId[tag.image_id]; | ||||
|     if (!tag_image) { return; } | ||||
| 
 | ||||
|     // Callback the tag's image itself.
 | ||||
|  | @ -693,7 +693,7 @@ function RepoCtrl($scope, $sanitize, Restangular, ImageMetadataService, ApiServi | |||
|     if (!tag_image.ancestors) { return; } | ||||
|     var ancestors = tag_image.ancestors.split('/'); | ||||
|     for (var i = 0; i < ancestors.length; ++i) { | ||||
|       var image = $scope.imageByInternalId[ancestors[i]]; | ||||
|       var image = $scope.imageByDockerId[ancestors[i]]; | ||||
|       if (image) { | ||||
|         callback(image); | ||||
|       } | ||||
|  | @ -782,10 +782,10 @@ function RepoCtrl($scope, $sanitize, Restangular, ImageMetadataService, ApiServi | |||
|       $scope.specificImages = []; | ||||
| 
 | ||||
|       // Build various images for quick lookup of images.
 | ||||
|       $scope.imageByInternalId = {}; | ||||
|       $scope.imageByDockerId = {}; | ||||
|       for (var i = 0; i < $scope.images.length; ++i) { | ||||
|         var currentImage = $scope.images[i]; | ||||
|         $scope.imageByInternalId[currentImage.internal_id] = currentImage; | ||||
|         $scope.imageByDockerId[currentImage.id] = currentImage; | ||||
|       } | ||||
| 
 | ||||
|       // Dispose of any existing tree.
 | ||||
|  |  | |||
|  | @ -307,8 +307,8 @@ ImageHistoryTree.prototype.setHighlightedPath_ = function(image) { | |||
|     this.markPath_(this.currentNode_, false); | ||||
|   } | ||||
| 
 | ||||
|   var imageByInternalId = this.imageByInternalId_; | ||||
|   var currentNode = imageByInternalId[image.internal_id]; | ||||
|   var imageByDockerId = this.imageByDockerId_; | ||||
|   var currentNode = imageByDockerId[image.id]; | ||||
|   if (currentNode) { | ||||
|     this.markPath_(currentNode, true); | ||||
|     this.currentNode_ = currentNode; | ||||
|  | @ -386,7 +386,7 @@ ImageHistoryTree.prototype.buildRoot_ = function() { | |||
|   var formatted = {"name": "No images found"}; | ||||
| 
 | ||||
|   // Build a node for each image.
 | ||||
|   var imageByInternalId = {}; | ||||
|   var imageByDockerId = {}; | ||||
|   for (var i = 0; i < this.images_.length; ++i) { | ||||
|     var image = this.images_[i]; | ||||
|     var imageNode = { | ||||
|  | @ -395,9 +395,9 @@ ImageHistoryTree.prototype.buildRoot_ = function() { | |||
|       "image": image, | ||||
|       "tags": image.tags | ||||
|     }; | ||||
|     imageByInternalId[image.internal_id] = imageNode; | ||||
|     imageByDockerId[image.id] = imageNode; | ||||
|   } | ||||
|   this.imageByInternalId_ = imageByInternalId; | ||||
|   this.imageByDockerId_ = imageByDockerId; | ||||
| 
 | ||||
|   // For each node, attach it to its immediate parent. If there is no immediate parent,
 | ||||
|   // then the node is the root.
 | ||||
|  | @ -408,10 +408,10 @@ ImageHistoryTree.prototype.buildRoot_ = function() { | |||
|     // Skip images that are currently uploading.
 | ||||
|     if (image.uploading) { continue; } | ||||
| 
 | ||||
|     var imageNode = imageByInternalId[image.internal_id]; | ||||
|     var imageNode = imageByDockerId[image.id]; | ||||
|     var ancestors = this.getAncestors_(image); | ||||
|     var immediateParent = ancestors[ancestors.length - 1]; | ||||
|     var parent = imageByInternalId[immediateParent]; | ||||
|     var parent = imageByDockerId[immediateParent]; | ||||
|     if (parent) {	    | ||||
|       // Add a reference to the parent. This makes walking the tree later easier.
 | ||||
|       imageNode.parent = parent; | ||||
|  | @ -442,7 +442,7 @@ ImageHistoryTree.prototype.buildRoot_ = function() { | |||
|     // Skip images that are currently uploading.
 | ||||
|     if (image.uploading) { continue; } | ||||
| 
 | ||||
|     var imageNode = imageByInternalId[image.internal_id]; | ||||
|     var imageNode = imageByDockerId[image.id]; | ||||
|     maxChildCount = Math.max(maxChildCount, this.determineMaximumChildCount_(imageNode)); | ||||
|   } | ||||
| 
 | ||||
|  | @ -573,7 +573,7 @@ ImageHistoryTree.prototype.setTag_ = function(tagName) { | |||
|     return; | ||||
|   } | ||||
| 
 | ||||
|   var imageByInternalId = this.imageByInternalId_; | ||||
|   var imageByDockerId = this.imageByDockerId_; | ||||
|    | ||||
|   // Save the current tag.
 | ||||
|   var previousTagName = this.currentTag_; | ||||
|  | @ -596,10 +596,10 @@ ImageHistoryTree.prototype.setTag_ = function(tagName) { | |||
|     // Skip images that are currently uploading.
 | ||||
|     if (image.uploading) { continue; } | ||||
| 
 | ||||
|     var imageNode = this.imageByInternalId_[image.internal_id]; | ||||
|     var imageNode = this.imageByDockerId_[image.id]; | ||||
|     var ancestors = this.getAncestors_(image); | ||||
|     var immediateParent = ancestors[ancestors.length - 1]; | ||||
|     var parent = imageByInternalId[immediateParent]; | ||||
|     var parent = imageByDockerId[immediateParent]; | ||||
|     if (parent && imageNode.highlighted) { | ||||
|       var arr = parent.children; | ||||
|       if (parent._children) { | ||||
|  |  | |||
		Reference in a new issue