Add caching for manifest labels
Helps reuse and makes UI faster when filtering
This commit is contained in:
parent
f17ef4adda
commit
94c41cc7e3
3 changed files with 9 additions and 1 deletions
|
@ -244,7 +244,7 @@
|
||||||
<td class="checkbox-col"></td>
|
<td class="checkbox-col"></td>
|
||||||
<td class="labels-col" colspan="{{5 + (Features.SECURITY_SCANNER ? 1 : 0)}}">
|
<td class="labels-col" colspan="{{5 + (Features.SECURITY_SCANNER ? 1 : 0)}}">
|
||||||
<div class="manifest-label-list" repository="repository"
|
<div class="manifest-label-list" repository="repository"
|
||||||
manifest-digest="tag.manifest_digest"></div>
|
manifest-digest="tag.manifest_digest" cache="labelCache"></div>
|
||||||
</td>
|
</td>
|
||||||
<td class="hidden-xs hidden-sm image-track" ng-repeat="it in imageTracks"
|
<td class="hidden-xs hidden-sm image-track" ng-repeat="it in imageTracks"
|
||||||
ng-if="imageTracks.length <= maxTrackCount" bindonce>
|
ng-if="imageTracks.length <= maxTrackCount" bindonce>
|
||||||
|
|
|
@ -36,6 +36,7 @@ angular.module('quay').directive('repoPanelTags', function () {
|
||||||
$scope.tagsPerPage = 25;
|
$scope.tagsPerPage = 25;
|
||||||
|
|
||||||
$scope.expandedView = false;
|
$scope.expandedView = false;
|
||||||
|
$scope.labelCache = {};
|
||||||
|
|
||||||
$scope.imageVulnerabilities = {};
|
$scope.imageVulnerabilities = {};
|
||||||
$scope.defcon1 = {};
|
$scope.defcon1 = {};
|
||||||
|
|
|
@ -11,6 +11,7 @@ angular.module('quay').directive('manifestLabelList', function () {
|
||||||
scope: {
|
scope: {
|
||||||
'repository': '=repository',
|
'repository': '=repository',
|
||||||
'manifestDigest': '=manifestDigest',
|
'manifestDigest': '=manifestDigest',
|
||||||
|
'cache': '=cache'
|
||||||
},
|
},
|
||||||
controller: function($scope, $element, ApiService) {
|
controller: function($scope, $element, ApiService) {
|
||||||
$scope.labels = null;
|
$scope.labels = null;
|
||||||
|
@ -24,6 +25,11 @@ angular.module('quay').directive('manifestLabelList', function () {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($scope.cache[$scope.manifestDigest]) {
|
||||||
|
$scope.labels = $scope.cache[$scope.manifestDigest];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$scope.labels = null;
|
$scope.labels = null;
|
||||||
$scope.loadError = false;
|
$scope.loadError = false;
|
||||||
|
|
||||||
|
@ -34,6 +40,7 @@ angular.module('quay').directive('manifestLabelList', function () {
|
||||||
|
|
||||||
ApiService.listManifestLabels(null, params).then(function(resp) {
|
ApiService.listManifestLabels(null, params).then(function(resp) {
|
||||||
$scope.labels = resp['labels'];
|
$scope.labels = resp['labels'];
|
||||||
|
$scope.cache[$scope.manifestDigest] = resp['labels'];
|
||||||
}, function() {
|
}, function() {
|
||||||
$scope.loadError = true;
|
$scope.loadError = true;
|
||||||
});
|
});
|
||||||
|
|
Reference in a new issue