summaryrefslogtreecommitdiffstats
path: root/ogcp/views.py
diff options
context:
space:
mode:
authorJavier Hernandez <jhernandez@soleta.eu>2024-01-30 11:20:56 +0100
committerOpenGnSys Support Team <soporte-og@soleta.eu>2024-01-30 11:29:57 +0100
commit556e06cc3d159c9b1b207a55d3f35f7d0ba048c6 (patch)
tree763a52e6f49bc9cfc4e0ca4e6778c19c57aa64fe /ogcp/views.py
parent5892d5c8c37ff412863afe2c9c6985f32276caf2 (diff)
Add list images action
Add list images action that shows a list of all the images in each server and their properties
Diffstat (limited to 'ogcp/views.py')
-rw-r--r--ogcp/views.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/ogcp/views.py b/ogcp/views.py
index f6f1fb7..fa6ebc2 100644
--- a/ogcp/views.py
+++ b/ogcp/views.py
@@ -2504,6 +2504,31 @@ def user_delete_get():
return render_template('auth/delete_user.html', form=form)
+@app.route('/action/image/list', methods=['GET'])
+@login_required
+def action_image_list():
+ params = request.args.to_dict()
+ ids = parse_elements(params)
+ server = get_server_from_ip_port(params['image-server'])
+ r = server.get('/images')
+ if not r:
+ return ogserver_down('images')
+ if r.status_code != requests.codes.ok:
+ return ogserver_error('images')
+ tmp = r.json()['images']
+ images = []
+ for img in tmp:
+ if img['id'] in ids:
+ images.append(img)
+ try:
+ images = get_images_grouped_by_repos()
+ except ServerError:
+ return ogserver_down('images')
+ except ServerErrorCode:
+ return ogserver_error('images')
+ return render_template('actions/list_images.html',
+ responses=images)
+
@app.route('/user/delete', methods=['POST'])
@login_required
def user_delete_post():