diff --git a/proxstar/__init__.py b/proxstar/__init__.py index b00a9b2..043c95a 100644 --- a/proxstar/__init__.py +++ b/proxstar/__init__.py @@ -197,7 +197,7 @@ def list_vms(user_view=None): vms.append(pending_vm) else: vms = 'INACTIVE' - return render_template('list_vms.html', user=user, rtp_view=False, vms=vms) + return render_template('list_vms.html', user=user, user_view=user_view, vms=vms) @app.route("/pools") def list_pools(): @@ -208,7 +208,7 @@ def list_pools(): abort(403) connect_proxmox() vms = get_pool_cache(db) - return render_template('list_vms.html', user=user, rtp_view=True, vms=vms) + return render_template('list_pools.html', user=user, rtp_view=True, vms=vms) @app.route('/isos') @auth.oidc_auth diff --git a/proxstar/templates/list_pools.html b/proxstar/templates/list_pools.html new file mode 100644 index 0000000..0eb5e62 --- /dev/null +++ b/proxstar/templates/list_pools.html @@ -0,0 +1,68 @@ +{% extends "base.html" %} +{% block body %} + +
+
+ {% for pool in vms %} +
+
+
+ +
+ + {{ pool['user'] }} + +
+ {{ pool['num_vms'] }} +
+
+
+ CPU +
+ {% if pool['percents']['cpu'] <= 60 %} +
+ {% elif pool['percents']['cpu'] <= 80 %} +
+ {% else %} +
+ {% endif %} +
+
+
+ MEM +
+ {% if pool['percents']['mem'] <= 60 %} +
+ {% elif pool['percents']['mem'] <= 80 %} +
+ {% else %} +
+ {% endif %} +
+
+
+ DISK +
+ {% if pool['percents']['disk'] <= 60 %} +
+ {% elif pool['percents']['disk'] <= 80 %} +
+ {% else %} +
+ {% endif %} +
+
+
+ + {% if not pool['vms'] %} + + {% endif %} +
+
+
+
+ {% endfor %} +
+
+ +{% endblock %} diff --git a/proxstar/templates/list_vms.html b/proxstar/templates/list_vms.html index 9e2b811..ca4bc33 100644 --- a/proxstar/templates/list_vms.html +++ b/proxstar/templates/list_vms.html @@ -3,11 +3,11 @@
- {% if user['rtp'] and rtp_view != True %} + {% if user_view %}
-
{{ rtp_view }}
+
{{ user_view.name }}
@@ -28,7 +28,7 @@
- {% elif rtp_view != True %} + {% else %} {% for vm in vms %}
@@ -45,66 +45,6 @@
{% endfor %} - {% else %} - {% for pool in vms %} -
-
-
- -
- - {{ pool['user'] }} - -
- {{ pool['num_vms'] }} -
-
-
- CPU -
- {% if pool['percents']['cpu'] <= 60 %} -
- {% elif pool['percents']['cpu'] <= 80 %} -
- {% else %} -
- {% endif %} -
-
-
- MEM -
- {% if pool['percents']['mem'] <= 60 %} -
- {% elif pool['percents']['mem'] <= 80 %} -
- {% else %} -
- {% endif %} -
-
-
- DISK -
- {% if pool['percents']['disk'] <= 60 %} -
- {% elif pool['percents']['disk'] <= 80 %} -
- {% else %} -
- {% endif %} -
-
-
- - {% if not pool['vms'] %} - - {% endif %} -
-
-
-
- {% endfor %} {% endif %}