diff options
author | Javier Hernandez <jhernandez@soleta.eu> | 2024-01-29 10:38:52 +0100 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2024-01-29 11:18:18 +0100 |
commit | a45f664905a6bb0d6e6e1510507ef62402f4d21e (patch) | |
tree | 1e653429aecb0d7261932b32284abfb667263fbe /ogcp/templates | |
parent | 7c86ecf9a1280d6994527bfb970e45a9f181549a (diff) |
dashboard: Show all servers, online or offline
Show in dashboard the list of all servers, regardless if they are online
or offline. If they are offline, uptime appears as 'offline'
Modify dashboard template to make it work with offline servers
Diffstat (limited to 'ogcp/templates')
-rw-r--r-- | ogcp/templates/dashboard.html | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/ogcp/templates/dashboard.html b/ogcp/templates/dashboard.html index 257cfe3..bc89128 100644 --- a/ogcp/templates/dashboard.html +++ b/ogcp/templates/dashboard.html @@ -30,14 +30,22 @@ <td>{{ server.images | length }}</td> <td> {% set disk = server.disk %} + {% if disk['total'] != 0 %} {% set used = (((disk['total'] - disk['free']) / disk['total']) * 100)|int %} + {% else %} + {% set used = 0 %} + {% endif %} <div class="progress progress-lg"> <div class="progress-bar bg-primary" style="width: {{used}}%"></div> </div> </td> <td> {% set memory = server.stats.memory %} + {% if memory['size'] != 0 %} {% set used = (((memory['size'] - memory['free']) / memory['size']) * 100)|int %} + {% else %} + {% set used = 0 %} + {% endif %} <div class="progress progress-lg"> <div class="progress-bar bg-primary" style="width: {{used}}%"></div> </div> @@ -64,7 +72,7 @@ <hr /> <ul class="nav nav-tabs" id="serversTab" role="tablist"> -{% for id, server in servers.items() %} +{% for id, server in servers.items() if server.online %} <li class="nav-item" role="presentation"> <button class="nav-link {% if loop.first %}active{% endif %}" id="{{ id }}-tab" data-toggle="tab" data-target="#{{ id }}" type="button" role="tab" aria-controls="{{ id }}" aria-selected="true"> {{ server.name }} @@ -74,7 +82,7 @@ </ul> <div class="tab-content" id="serversTabContent"> -{% for id, server in servers.items() %} +{% for id, server in servers.items() if server.online %} {% set stats = server.stats %} {% set time_dict = server.time_dict %} {% set images = server.images %} |