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
|
@ -87,7 +87,7 @@ class ImageRepositoryRepository(
|
|||
"""
|
||||
|
||||
def to_dict(self):
|
||||
return {
|
||||
img_repo = {
|
||||
'namespace': self.repository_base_elements.namespace_name,
|
||||
'name': self.repository_base_elements.repository_name,
|
||||
'kind': self.repository_base_elements.kind_name,
|
||||
|
@ -95,12 +95,13 @@ class ImageRepositoryRepository(
|
|||
'is_public': self.repository_base_elements.is_public,
|
||||
'is_organization': self.repository_base_elements.namespace_user_organization,
|
||||
'is_starred': self.repository_base_elements.is_starred,
|
||||
'tags': {tag.name: tag.to_dict()
|
||||
for tag in self.tags},
|
||||
'status_token': self.badge_token if not self.repository_base_elements.is_public else '',
|
||||
'trust_enabled': bool(features.SIGNING) and self.trust_enabled,
|
||||
'tag_expiration_s': self.repository_base_elements.namespace_user_removed_tag_expiration_s,
|
||||
}
|
||||
if self.tags is not None:
|
||||
img_repo['tags'] = {tag.name: tag.to_dict() for tag in self.tags}
|
||||
return img_repo
|
||||
|
||||
|
||||
class Repository(namedtuple('Repository', [
|
||||
|
@ -203,7 +204,7 @@ class RepositoryDataInterface(object):
|
|||
"""
|
||||
|
||||
@abstractmethod
|
||||
def get_repo(self, namespace_name, repository_name, user):
|
||||
def get_repo(self, namespace_name, repository_name, user, include_tags=True, max_tags=500):
|
||||
"""
|
||||
Returns a repository
|
||||
"""
|
||||
|
|
Reference in a new issue