From 0c66443db89fec72c5fb2af0588a02695683613c Mon Sep 17 00:00:00 2001 From: Daniel GarcĂ­a Moreno Date: Wed, 14 Sep 2022 14:01:18 +0200 Subject: Add multiple servers to the dashboard view --- ogcp/templates/dashboard.html | 642 ++++++++++++++++++++++++------------------ 1 file changed, 364 insertions(+), 278 deletions(-) (limited to 'ogcp/templates/dashboard.html') diff --git a/ogcp/templates/dashboard.html b/ogcp/templates/dashboard.html index e1d9dc4..38dbafd 100644 --- a/ogcp/templates/dashboard.html +++ b/ogcp/templates/dashboard.html @@ -3,310 +3,396 @@ {% block nav_dashboard %}active{% endblock %} {% block content %} +
-
-
    -
  • - {{ _('Date') }} -
  • -
  • -

    {{ time_dict['now'] }}

    -
  • -
-
    -
  • - {{ _('Uptime') }} -
  • -
  • -

    {{ time_dict['boot'] }}

    -
  • -
-
    -
  • - {{ _('ogServer uptime') }} -
  • -
  • -

    {{ time_dict['start'] }}

    -
  • -
-
    -
  • - {{ _('Connected clients (ogClient)') }} -
  • -
  • -

    {{ clients['clients'] | length }}

    -
  • -
-
    -
  • - {{ _('Number of images') }} -
  • -
  • -

    {{ images | length }}

    -
  • -
-
+
+ + + + + + + + + + + + + + + {% for id, server in servers.items() %} + + + + + + + + + {% set swap = server.stats.swap %} + {% if swap.size %} + + {% else %} + + {% endif %} + + {% endfor %} + - -
-
-
- {{ _('Disk stats') }} -
-
- -
    -
  • - {{ _('Disk size') }} -
  • -
  • - {{ _('used') }} (%) -
  • -
  • - {{ _('available') }} (%) -
  • -
-
    -
  • - {{ disk['total'] // 2**30 }} Gbytes -
  • -
  • - {{ (disk['total'] - disk['free']) // 2**30 }} Gbytes - ({{ (((disk['total'] - disk['free']) / disk['total']) * 100)|int }}%) -
  • -
  • - {{ disk['free'] // 2**30 }} Gbytes - ({{ ((disk['free'] / disk['total']) * 100)|int }}%) -
  • -
-
-
+
ServerUptimeogServer uptimeConnected clientsNumber of imagesDiskMemorySwap
{{ server.name }}{{ server.time_dict.boot }}{{ server.time_dict.start }}{{ server.clients | length }}{{ server.images | length }} + {% set disk = server.disk %} + {% set used = (((disk['total'] - disk['free']) / disk['total']) * 100)|int %} +
+
+
+
+ {% set memory = server.stats.memory %} + {% set used = (((memory['size'] - memory['free']) / memory['size']) * 100)|int %} +
+
+
+
+ {% set used = (((swap['size'] - swap['free']) / swap['size']) * 100)|int %} +
+
+
+
No swap
+
- -
-
-
- {{ _('Memory') }} -
-
- -
    -
  • - {{ _('Memory size') }} -
  • -
  • - {{ _('used') }} (%) -
  • -
  • - {{ _('available') }} (%) -
  • -
-
    -
  • - {{ (stats['memory']['size'] / 2**30)|round(3) }} Gbytes -
  • -
  • - {{ ((stats['memory']['size'] - stats['memory']['free']) / 2**30)|round(3) }} Gbytes - ({{ (((stats['memory']['size'] - stats['memory']['free']) / stats['memory']['size']) * 100)|int }}%) -
  • -
  • - {{ (stats['memory']['free'] / 2**30)|round(3) }} Gbytes - ({{ ((stats['memory']['free'] / stats['memory']['size']) * 100)|int }}%) -
  • -
-
-
-
+
- -
-
-
- {{ _('Swap') }} -
-
- {% if stats['swap']['size'] %} - -
    -
  • - {{ _('swap size') }} -
  • -
  • - {{ _('used') }} (%) -
  • -
  • - {{ _('available') }} (%) -
  • -
-
    -
  • - {{ (stats['swap']['size'] / 2**30)|round(3) }} Gbytes -
  • -
  • - {{ ((stats['swap']['size'] - stats['swap']['free']) / 2**30)|round(3) }} Gbytes - ({{ (((stats['swap']['size'] - stats['swap']['free']) / stats['swap']['size']) * 100)|int }}%) -
  • -
  • - {{ (stats['swap']['free'] / 2**30)|round(3) }} Gbytes - ({{ ((stats['swap']['free'] / stats['swap']['size']) * 100)|int }}%) -
  • -
- {% else %} -

No swap

- {% endif %} -
-
-
+ - -
-
-
- {{ _('Latest images') }} -
- {% for image in images[:10] %} +
+{% for id, server in servers.items() %} + {% set stats = server.stats %} + {% set time_dict = server.time_dict %} + {% set images = server.images %} + {% set disk = server.disk %} + {% set oglive_list = server.oglive_list %} + +
+
+
  • - {{ image['name'] }} + {{ _('Date') }}
  • - {{ image['modified'] }} +

    {{ time_dict['now'] }}

- {% endfor %} -
-
+
    +
  • + {{ _('Uptime') }} +
  • +
  • +

    {{ time_dict['boot'] }}

    +
  • +
+
    +
  • + {{ _('ogServer uptime') }} +
  • +
  • +

    {{ time_dict['start'] }}

    +
  • +
+
    +
  • + {{ _('Connected clients (ogClient)') }} +
  • +
  • +

    {{ server.clients | length }}

    +
  • +
+
    +
  • + {{ _('Number of images') }} +
  • +
  • +

    {{ images | length }}

    +
  • +
+
+ + +
+
+
+ {{ _('Disk stats') }} +
+
+ +
    +
  • + {{ _('Disk size') }} +
  • +
  • + {{ _('used') }} (%) +
  • +
  • + {{ _('available') }} (%) +
  • +
+
    +
  • + {{ disk['total'] // 2**30 }} Gbytes +
  • +
  • + {{ (disk['total'] - disk['free']) // 2**30 }} Gbytes + ({{ (((disk['total'] - disk['free']) / disk['total']) * 100)|int }}%) +
  • +
  • + {{ disk['free'] // 2**30 }} Gbytes + ({{ ((disk['free'] / disk['total']) * 100)|int }}%) +
  • +
+
+
+
+ + +
+
+
+ {{ _('Memory') }} +
+
+ +
    +
  • + {{ _('Memory size') }} +
  • +
  • + {{ _('used') }} (%) +
  • +
  • + {{ _('available') }} (%) +
  • +
+
    +
  • + {{ (stats['memory']['size'] / 2**30)|round(3) }} Gbytes +
  • +
  • + {{ ((stats['memory']['size'] - stats['memory']['free']) / 2**30)|round(3) }} Gbytes + ({{ (((stats['memory']['size'] - stats['memory']['free']) / stats['memory']['size']) * 100)|int }}%) +
  • +
  • + {{ (stats['memory']['free'] / 2**30)|round(3) }} Gbytes + ({{ ((stats['memory']['free'] / stats['memory']['size']) * 100)|int }}%) +
  • +
+
+
+
+ + +
+
+
+ {{ _('Swap') }} +
+
+ {% if stats['swap']['size'] %} + +
    +
  • + {{ _('swap size') }} +
  • +
  • + {{ _('used') }} (%) +
  • +
  • + {{ _('available') }} (%) +
  • +
+
    +
  • + {{ (stats['swap']['size'] / 2**30)|round(3) }} Gbytes +
  • +
  • + {{ ((stats['swap']['size'] - stats['swap']['free']) / 2**30)|round(3) }} Gbytes + ({{ (((stats['swap']['size'] - stats['swap']['free']) / stats['swap']['size']) * 100)|int }}%) +
  • +
  • + {{ (stats['swap']['free'] / 2**30)|round(3) }} Gbytes + ({{ ((stats['swap']['free'] / stats['swap']['size']) * 100)|int }}%) +
  • +
+ {% else %} +

No swap

+ {% endif %} +
+
+
- -
-
-
- {{ _('ogLive images') }} + +
+
+
+ {{ _('Latest images') }} +
+ {% for image in images[:10] %} +
    +
  • + {{ image['name'] }} +
  • +
  • + {{ image['modified'] }} +
  • +
+ {% endfor %} +
+
+ + +
+
+
+ {{ _('ogLive images') }} +
+
    + {% for oglive in oglive_list['oglive'] %} +
  • + {{ oglive['directory'] }} + {% if loop.index0 == oglive_list['default'] %} + ({{ _('default') }}) + {% endif %} +
  • + {% endfor %} +
+
+
-
    - {% for oglive in oglive_list['oglive'] %} -
  • - {{ oglive['directory'] }} - {% if loop.index0 == oglive_list['default'] %} - ({{ _('default') }}) - {% endif %} -
  • - {% endfor %} -
-
+{% endfor %}
{% endblock %} {% block extrabody %} - + }; + var swapChart = new Chart( + document.getElementById('swapChart-{{ id }}'), + swapChartConfig, + ); + {% endif %} + + +{% endfor %} {% endblock %} -- cgit v1.2.3-18-g5258