views: Fix bug in images view

Fix unusable image view when an image has a repo associated that no longer
exists. Display image under "unknown" if there is no repo for it.
master
Javier Hernandez 2024-01-15 11:02:43 +01:00 committed by OpenGnSys Support Team
parent 19e0517511
commit bf90e91e24
1 changed files with 6 additions and 3 deletions

View File

@ -1711,10 +1711,13 @@ def get_images_grouped_by_repos():
repo_id=image['repo_id']
repo_data={}
if repo_id not in repos:
repo_name = [repo['name'] for repo in all_repos
if repo_id == repo['id']][0]
image_repo = [repo['name'] for repo in all_repos
if repo_id == repo['id']]
repos[repo_id] = {}
repos[repo_id]['name'] = repo_name
if image_repo:
repos[repo_id]['name'] = image_repo[0]
else:
repos[repo_id]['name'] = 'unknown'
repos[repo_id]['images'] = [image]
else:
repos[repo_id]['images'].append(image)