From 4382ba24016f27f1cf190822a2152ae41cecfaa9 Mon Sep 17 00:00:00 2001 From: Miguel Caballer Date: Mon, 28 Oct 2024 10:38:40 +0100 Subject: [PATCH 1/3] Unable set float sizes --- app/__init__.py | 4 ++-- app/templates/vminfo.html | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index 7118b750..441e89db 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -395,9 +395,9 @@ def managevm(op=None, infid=None, vmid=None): elif op == "resize": form_data = request.form.to_dict() cpu = int(form_data['cpu']) - memory = int(form_data['memory']) + memory = float(form_data['memory']) gpu = int(form_data.get('gpu', 0)) - disk_size = int(form_data.get('disk_size', 0)) + disk_size = float(form_data.get('disk_size', 0)) vminforesp = im.get_vm_info(infid, vmid, auth_data, "text/plain") if vminforesp.ok: diff --git a/app/templates/vminfo.html b/app/templates/vminfo.html index 860f8fd8..c60d1838 100644 --- a/app/templates/vminfo.html +++ b/app/templates/vminfo.html @@ -328,21 +328,21 @@
- CPU Number: + CPU Number:
{% set memory_parts = memory.split() %} - Memory (GB): + Memory (GB):
- GPU Number: + GPU Number:
{% set disk_size_parts = disk_size.split() %} - Disk Size (GB): + Disk Size (GB):
From c35d24179c4a57c5fcfa96cbf72d6fce45cf2f8b Mon Sep 17 00:00:00 2001 From: Miguel Caballer Date: Mon, 28 Oct 2024 10:38:59 +0100 Subject: [PATCH 2/3] Maintain IM inf list order --- app/__init__.py | 2 +- app/templates/infrastructures.html | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index 441e89db..00a60030 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -523,7 +523,7 @@ def showinfrastructures(): infrastructures[inf_id]['cloud_type'] = infra_data["site"]["type"] infrastructures[inf_id]['site'] = Markup(site_info) - return render_template('infrastructures.html', infrastructures=infrastructures, reload=reload_infid) + return render_template('infrastructures.html', infrastructures=infrastructures, reload=reload_infid, inf_list=inf_list) @app.route('/infrastructures/state') @authorized_with_valid_token diff --git a/app/templates/infrastructures.html b/app/templates/infrastructures.html index c6cc8be1..f68c01ed 100644 --- a/app/templates/infrastructures.html +++ b/app/templates/infrastructures.html @@ -166,8 +166,9 @@

My Infrastructures

- {% for infId, infInfo in infrastructures.items() %} + {% for infId in inf_list %} + {% set infInfo=infrastructures[infId] %} {% if infInfo["name"] != "" %} {{infInfo["name"]}} From a1da3f501cc314f92a1be7482bf26d4e5dbb5bd3 Mon Sep 17 00:00:00 2001 From: Miguel Caballer Date: Mon, 28 Oct 2024 10:41:29 +0100 Subject: [PATCH 3/3] Fix style --- app/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/__init__.py b/app/__init__.py index 00a60030..14ea6585 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -523,7 +523,8 @@ def showinfrastructures(): infrastructures[inf_id]['cloud_type'] = infra_data["site"]["type"] infrastructures[inf_id]['site'] = Markup(site_info) - return render_template('infrastructures.html', infrastructures=infrastructures, reload=reload_infid, inf_list=inf_list) + return render_template('infrastructures.html', infrastructures=infrastructures, + reload=reload_infid, inf_list=inf_list) @app.route('/infrastructures/state') @authorized_with_valid_token