Repository endpoint tags pagination (#3238)
* endpoint/api/repository: limit the number of tags returned - Limit the number of tags returned by /api/v1/repository/<ns:repo> to 500. - Uses the tag history endpoint instead, with an active tag filte. - Update UI to use tag history endpoint instead.
This commit is contained in:
parent
6d5489b254
commit
8e643ce5d9
16 changed files with 99 additions and 34 deletions
|
@ -237,13 +237,13 @@ angular.module('quay').directive('repoPanelTags', function () {
|
|||
}));
|
||||
}, true);
|
||||
|
||||
$scope.$watch('repository', function(repository) {
|
||||
if (!repository) { return; }
|
||||
$scope.$watch('repository', function(updatedRepoObject, previousRepoObject) {
|
||||
if (updatedRepoObject.tags === previousRepoObject.tags) { return; }
|
||||
|
||||
// Process each of the tags.
|
||||
setTagState();
|
||||
loadRepoSignatures();
|
||||
});
|
||||
}, true);
|
||||
|
||||
$scope.loadImageVulnerabilities = function(image_id, imageData) {
|
||||
VulnerabilityService.loadImageVulnerabilities($scope.repository, image_id, function(resp) {
|
||||
|
|
|
@ -46,7 +46,7 @@ angular.module('quay').directive('tagOperationsDialog', function () {
|
|||
};
|
||||
|
||||
$scope.isAnotherImageTag = function(image, tag) {
|
||||
if (!$scope.repository) { return; }
|
||||
if (!$scope.repository.tags) { return; }
|
||||
|
||||
var found = $scope.repository.tags[tag];
|
||||
if (found == null) { return false; }
|
||||
|
@ -54,7 +54,7 @@ angular.module('quay').directive('tagOperationsDialog', function () {
|
|||
};
|
||||
|
||||
$scope.isOwnedTag = function(image, tag) {
|
||||
if (!$scope.repository) { return; }
|
||||
if (!$scope.repository.tags) { return; }
|
||||
|
||||
var found = $scope.repository.tags[tag];
|
||||
if (found == null) { return false; }
|
||||
|
|
|
@ -25,7 +25,8 @@
|
|||
var params = {
|
||||
'repository': $scope.namespace + '/' + $scope.name,
|
||||
'repo_kind': 'application',
|
||||
'includeStats': true
|
||||
'includeStats': true,
|
||||
'includeTags': false
|
||||
};
|
||||
|
||||
$scope.repositoryResource = ApiService.getRepoAsResource(params).get(function(repo) {
|
||||
|
|
|
@ -35,7 +35,8 @@
|
|||
|
||||
var loadRepository = function() {
|
||||
var params = {
|
||||
'repository': $scope.namespace + '/' + $scope.name
|
||||
'repository': $scope.namespace + '/' + $scope.name,
|
||||
'includeTags': false
|
||||
};
|
||||
|
||||
$scope.repoResource = ApiService.getRepoAsResource(params).get(function(repo) {
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
|
||||
var loadRepository = function() {
|
||||
var params = {
|
||||
'repository': $scope.namespace + '/' + $scope.name
|
||||
'repository': $scope.namespace + '/' + $scope.name,
|
||||
'includeTags': false
|
||||
};
|
||||
|
||||
$scope.repositoryResource = ApiService.getRepoAsResource(params).get(function(repo) {
|
||||
|
@ -30,4 +31,4 @@
|
|||
$location.url('repository/' + $scope.namespace + '/' + $scope.name + '?tab=settings');
|
||||
};
|
||||
}
|
||||
})();
|
||||
})();
|
||||
|
|
|
@ -36,7 +36,8 @@
|
|||
|
||||
var loadRepository = function() {
|
||||
var params = {
|
||||
'repository': namespace + '/' + name
|
||||
'repository': namespace + '/' + name,
|
||||
'includeTags': false
|
||||
};
|
||||
|
||||
$scope.repositoryResource = ApiService.getRepoAsResource(params).get(function(repo) {
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
'historyFilter': ''
|
||||
};
|
||||
|
||||
$scope.repositoryTags = {};
|
||||
|
||||
var buildPollChannel = null;
|
||||
|
||||
// Make sure we track the current user.
|
||||
|
@ -50,17 +52,48 @@
|
|||
});
|
||||
};
|
||||
|
||||
var loadRepositoryTags = function() {
|
||||
loadPaginatedRepositoryTags(1);
|
||||
};
|
||||
|
||||
var loadPaginatedRepositoryTags = function(page) {
|
||||
var params = {
|
||||
'repository': $scope.namespace + '/' + $scope.name,
|
||||
'limit': 100,
|
||||
'page': page,
|
||||
'onlyActiveTags': true
|
||||
};
|
||||
|
||||
ApiService.listRepoTags(null, params).then(function(resp) {
|
||||
var newTags = resp.tags.reduce(function(result, item, index, array) {
|
||||
var tag_name = item['name'];
|
||||
result[tag_name] = item;
|
||||
return result;
|
||||
}, {});
|
||||
|
||||
$.extend($scope.repositoryTags, newTags);
|
||||
|
||||
if (resp.has_additional) {
|
||||
loadPaginatedRepositoryTags(page + 1);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var loadRepository = function() {
|
||||
// Mark the images to be reloaded.
|
||||
$scope.viewScope.images = null;
|
||||
|
||||
var params = {
|
||||
'repository': $scope.namespace + '/' + $scope.name,
|
||||
'includeStats': true
|
||||
'includeStats': true,
|
||||
'includeTags': false
|
||||
};
|
||||
|
||||
$scope.repositoryResource = ApiService.getRepoAsResource(params).get(function(repo) {
|
||||
if (repo != undefined) {
|
||||
loadRepositoryTags();
|
||||
repo.tags = $scope.repositoryTags;
|
||||
|
||||
$scope.repository = repo;
|
||||
$scope.viewScope.repository = repo;
|
||||
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
|
||||
var loadRepository = function() {
|
||||
var params = {
|
||||
'repository': namespace + '/' + name
|
||||
'repository': namespace + '/' + name,
|
||||
'includeTags': false
|
||||
};
|
||||
|
||||
$scope.repositoryResource = ApiService.getRepoAsResource(params).get(function(repo) {
|
||||
|
@ -86,4 +87,4 @@
|
|||
return trigger_uuid.split('-')[0];
|
||||
};
|
||||
}
|
||||
}());
|
||||
}());
|
||||
|
|
Reference in a new issue