From b4856c9b279d30f8d0101efd14aca157b1535bea Mon Sep 17 00:00:00 2001 From: Javier Hernandez Date: Wed, 3 Jan 2024 11:29:24 +0100 Subject: templates: Make stilistic changes in dashboard - Remove a table with redundant info; it was displaying server's stats, which was already in another table - Add last update info at the top of the page - Make page more robust by checking if ogLive images are available. Before this patch, page shows a traceback if the ogLive list are not available. --- ogcp/templates/dashboard.html | 65 ++++++++++--------------------------------- ogcp/views.py | 3 +- 2 files changed, 17 insertions(+), 51 deletions(-) diff --git a/ogcp/templates/dashboard.html b/ogcp/templates/dashboard.html index 38dbafd..257cfe3 100644 --- a/ogcp/templates/dashboard.html +++ b/ogcp/templates/dashboard.html @@ -4,6 +4,7 @@ {% block content %} +

Last update: {{ now }}

@@ -82,48 +83,6 @@
-
-
    -
  • - {{ _('Date') }} -
  • -
  • -

    {{ time_dict['now'] }}

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

    {{ time_dict['boot'] }}

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

    {{ time_dict['start'] }}

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

    {{ server.clients | length }}

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

    {{ images | length }}

    -
  • -
-
@@ -263,14 +222,20 @@ {{ _('ogLive images') }}
    - {% for oglive in oglive_list['oglive'] %} -
  • - {{ oglive['directory'] }} - {% if loop.index0 == oglive_list['default'] %} - ({{ _('default') }}) - {% endif %} -
  • - {% endfor %} + {% if oglive_list %} + {% for oglive in oglive_list['oglive'] %} +
  • + {{ oglive['directory'] }} + {% if loop.index0 == oglive_list['default'] %} + ({{ _('default') }}) + {% endif %} +
  • + {% endfor %} + {% else %} +
  • + No ogLive images available +
  • + {% endif %}
diff --git a/ogcp/views.py b/ogcp/views.py index ba9f1a3..db56169 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -380,7 +380,8 @@ def index(): server_id = i['server'].id dashboard_servers[server_id]['clients'] = i['json']['clients'] - return render_template('dashboard.html', servers=dashboard_servers, colsize="6") + now = timestamp.strftime('%Y-%m-%d %H:%M:%S') + return render_template('dashboard.html', servers=dashboard_servers, now=now, colsize="6") @app.route('/login', methods=['GET', 'POST']) def login(): -- cgit v1.2.3-18-g5258