Instead of sending DB IDs, send "internal IDs" which are DB IDs hashed. This way, we can still calculate the ancestors without hitting the DB further, but without leaking the size of the images table
This commit is contained in:
parent
dd4037e324
commit
63628678b8
7 changed files with 59 additions and 36 deletions
|
@ -5757,7 +5757,7 @@ quayApp.directive('tagSpecificImagesView', function () {
|
|||
}
|
||||
|
||||
var currentTag = $scope.repository.tags[$scope.tag];
|
||||
if (image.dbid == currentTag.dbid) {
|
||||
if (image.internal_id == currentTag.internal_id) {
|
||||
classes += 'tag-image ';
|
||||
}
|
||||
|
||||
|
@ -5767,15 +5767,15 @@ quayApp.directive('tagSpecificImagesView', function () {
|
|||
var forAllTagImages = function(tag, callback, opt_cutoff) {
|
||||
if (!tag) { return; }
|
||||
|
||||
if (!$scope.imageByDBID) {
|
||||
$scope.imageByDBID = [];
|
||||
if (!$scope.imageByInternalId) {
|
||||
$scope.imageByInternalId = [];
|
||||
for (var i = 0; i < $scope.images.length; ++i) {
|
||||
var currentImage = $scope.images[i];
|
||||
$scope.imageByDBID[currentImage.dbid] = currentImage;
|
||||
$scope.imageByInternalId[currentImage.internal_id] = currentImage;
|
||||
}
|
||||
}
|
||||
|
||||
var tag_image = $scope.imageByDBID[tag.dbid];
|
||||
var tag_image = $scope.imageByInternalId[tag.internal_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.imageByDBID[ancestors[i]];
|
||||
var image = $scope.imageByInternalId[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.dbid] = true;
|
||||
ids[image.internal_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 dbid in getIdsForTag(currentTag)) {
|
||||
delete toDelete[dbid];
|
||||
for (var internal_id in getIdsForTag(currentTag)) {
|
||||
delete toDelete[internal_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.dbid]) {
|
||||
if (toDelete[image.internal_id]) {
|
||||
images.push(image);
|
||||
}
|
||||
}
|
||||
|
@ -5841,7 +5841,7 @@ quayApp.directive('tagSpecificImagesView', function () {
|
|||
return result;
|
||||
}
|
||||
|
||||
return b.dbid - a.dbid;
|
||||
return b.sort_index - a.sort_index;
|
||||
});
|
||||
|
||||
$scope.tagSpecificImages = images;
|
||||
|
|
Reference in a new issue