From 0b424aa34effb9865e8e7cbcefe73d77b9465647 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20S=C3=A1nchez=20Parra?= Date: Mon, 11 Oct 2021 15:37:42 +0200 Subject: [PATCH] Add partitions info to client details Show a table with client's disks and partitions information. --- ogcp/templates/actions/client_details.html | 24 ++++++++++++++++++++++ ogcp/views.py | 16 ++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/ogcp/templates/actions/client_details.html b/ogcp/templates/actions/client_details.html index 39963bd..d4158bf 100644 --- a/ogcp/templates/actions/client_details.html +++ b/ogcp/templates/actions/client_details.html @@ -10,4 +10,28 @@ button_map={'create': 'primary'}, extra_classes="mx-5") }} + + + + + + + + + + + + + {% for entry in setup %} + + + + + + + + {% endfor %} + +
PartitionTypeFilesytemSize (KB)Image
{{ entry.partition }}{{ entry.code }}{{ entry.filesystem }}{{ entry.size }}{{ entry.image }}
+ {% endblock %} diff --git a/ogcp/views.py b/ogcp/views.py index a42642f..77e63ac 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -527,7 +527,21 @@ def action_client_info(): form.room.choices = list(rooms) form.create.render_kw = {"style": "visibility:hidden;"} - return render_template('actions/client_details.html', form=form) + + r = g.server.get('/images') + images = r.json()['images'] + + setup = get_client_setup(ips) + + for entry in setup: + if entry['image'] != 0: + image = next(img for img in images if img['id'] == entry['image']) + entry['image'] = image['name'] + else: + entry['image'] = "" + + return render_template('actions/client_details.html', form=form, + setup=setup) @app.route('/action/client/add', methods=['GET', 'POST']) @login_required