Skip to content

Commit

Permalink
ui: fixing tag list reset when rendering manifest lists (PROJQUAY-579…
Browse files Browse the repository at this point in the history
…3) (quay#2643)

fixing tag list reset when rendering manifest lists
  • Loading branch information
bcaton85 authored Feb 5, 2024
1 parent 746e372 commit eec2c0f
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions static/js/directives/repo-view/repo-panel-tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ angular.module('quay').directive('repoPanelTags', function () {
});

$scope.Features = Features;

$scope.maxTrackCount = 5;

$scope.checkedTags = UIService.createCheckStateController([], 'name');
Expand Down Expand Up @@ -88,7 +88,7 @@ angular.module('quay').directive('repoPanelTags', function () {

var cosignSignatureTag = matchCosignSignature(tag);

if (cosignSignatureTag) {
if (cosignSignatureTag) {
signedManifestDigest = cosignSignatureTag[1]; // cosign signature tags contain the signature of the signed manifest
$scope.cosignedManifests["sha256:" + signedManifestDigest] = { // map signed manifests to their cosign signature artifact
'signatureTagName': tag,
Expand Down Expand Up @@ -290,6 +290,21 @@ angular.module('quay').directive('repoPanelTags', function () {

$scope.$watch('repositoryTags', function(newTags, oldTags) {
if (newTags === oldTags) { return; }

// Filter out properties that should not cause the tag list to be reset,
// specifically loading sub-manifests
let filteredOldTags = {};
for (const [key, value] of Object.entries(oldTags)) {
let {manifest_list_loading, manifest_list, $$hashKey, _mapped_manifests, ...properties} = value;
filteredOldTags[key] = properties;
}
let filteredNewTags = {};
for (const [key, value] of Object.entries(newTags)) {
let {manifest_list_loading, manifest_list, $$hashKey, _mapped_manifests, ...properties} = value;
filteredNewTags[key] = properties;
}
if(JSON.stringify(filteredOldTags) === JSON.stringify(filteredNewTags)){return;}

// Process each of the tags.
getCosignSignatures();
setTagState();
Expand Down Expand Up @@ -562,7 +577,9 @@ angular.module('quay').directive('repoPanelTags', function () {
})
if (!childrenLayers) {
tag.manifest_list.manifests.forEach(function(child_manifest) {
$scope.loadManifestLayers(child_manifest);
if(!child_manifest.layers){
$scope.loadManifestLayers(child_manifest);
}
});
return tag.manifest_list.manifests;
}
Expand Down

0 comments on commit eec2c0f

Please sign in to comment.