UI and API improvements for working with large repositories

- Change the tag check bar to only select the current page (by default), but allow for selecting ALL tags
- Limit the number of tags compared in the visualization view to 10
- Fix the multiselect dropdown to limit itself to 10 items selected
- Remove saving the selected tags in the URL, as it is too slow and overloads the URLs in Chrome when there are 1000+ tags selected
- Change the images API to not return locations: By skipping the extra join and looping, it made the /images API call 10x faster (in hand tests)

Fixes #292
Fixes #293
This commit is contained in:
Joseph Schorr 2015-07-31 16:31:29 -04:00
parent 55a0b83ddf
commit 4160b720f9
9 changed files with 125 additions and 54 deletions

View file

@ -11,7 +11,7 @@ from data import model
from util.cache import cache_control_flask_restful
def image_view(image, image_map, include_locations=True, include_ancestors=True):
def image_view(image, image_map, include_ancestors=True):
extended_props = image
if image.storage and image.storage.id:
extended_props = image.storage
@ -34,9 +34,6 @@ def image_view(image, image_map, include_locations=True, include_ancestors=True)
'sort_index': len(image.ancestors),
}
if include_locations:
image_data['locations'] = list(image.storage.locations)
if include_ancestors:
# Calculate the ancestors string, with the DBID's replaced with the docker IDs.
ancestors = [docker_id(a) for a in image.ancestors.split('/')]
@ -48,7 +45,7 @@ def image_view(image, image_map, include_locations=True, include_ancestors=True)
def historical_image_view(image, image_map):
ancestors = [image_map[a] for a in image.ancestors.split('/')[1:-1]]
normal_view = image_view(image, image_map)
normal_view['history'] = [image_view(parent, image_map, False, False) for parent in ancestors]
normal_view['history'] = [image_view(parent, image_map, False) for parent in ancestors]
return normal_view
@ -60,7 +57,11 @@ class RepositoryImageList(RepositoryParamResource):
@nickname('listRepositoryImages')
def get(self, namespace, repository):
""" List the images for the specified repository. """
all_images = model.image.get_repository_images(namespace, repository)
repo = model.repository.get_repository(namespace, repository)
if not repo:
raise NotFound()
all_images = model.image.get_repository_images_without_placements(repo)
all_tags = model.tag.list_repository_tags(namespace, repository)
tags_by_image_id = defaultdict(list)