Performance improvements for the repo API and the new repo UI
This commit is contained in:
parent
bc6baae050
commit
ab2331a486
9 changed files with 119 additions and 100 deletions
|
@ -1146,6 +1146,9 @@ def get_repo_image_extended(namespace_name, repository_name, docker_image_id):
|
|||
|
||||
return images[0]
|
||||
|
||||
def is_repository_public(repository):
|
||||
return repository.visibility == _get_public_repo_visibility()
|
||||
|
||||
def repository_is_public(namespace_name, repository_name):
|
||||
try:
|
||||
(Repository
|
||||
|
@ -1579,9 +1582,15 @@ def _tag_alive(query):
|
|||
(RepositoryTag.lifetime_end_ts > int(time.time())))
|
||||
|
||||
|
||||
def list_repository_tags(namespace_name, repository_name, include_hidden=False):
|
||||
def list_repository_tags(namespace_name, repository_name, include_hidden=False,
|
||||
include_storage=False):
|
||||
|
||||
toSelect = (RepositoryTag, Image)
|
||||
if include_storage:
|
||||
toSelect = (RepositoryTag, Image, ImageStorage)
|
||||
|
||||
query = _tag_alive(RepositoryTag
|
||||
.select(RepositoryTag, Image)
|
||||
.select(*toSelect)
|
||||
.join(Repository)
|
||||
.join(Namespace, on=(Repository.namespace_user == Namespace.id))
|
||||
.switch(RepositoryTag)
|
||||
|
@ -1592,6 +1601,9 @@ def list_repository_tags(namespace_name, repository_name, include_hidden=False):
|
|||
if not include_hidden:
|
||||
query = query.where(RepositoryTag.hidden == False)
|
||||
|
||||
if include_storage:
|
||||
query = query.switch(Image).join(ImageStorage)
|
||||
|
||||
return query
|
||||
|
||||
|
||||
|
|
Reference in a new issue