diff options
author | Javier Hernandez <jhernandez@soleta.eu> | 2024-01-03 11:29:24 +0100 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2024-01-03 11:39:02 +0100 |
commit | b4856c9b279d30f8d0101efd14aca157b1535bea (patch) | |
tree | d71a1c68247c2c97451e96787d93db72b8ae39ce | |
parent | 1497e500cb0a11689796cfb2fd4aabeb89f72b58 (diff) |
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.
-rw-r--r-- | ogcp/templates/dashboard.html | 65 | ||||
-rw-r--r-- | 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 %} +<p class="text-left">Last update: {{ now }}</p> <div class="row"> <div class="card col-12"> <table class="table"> @@ -82,48 +83,6 @@ <div class="tab-pane {% if loop.first %}show active{% endif %}" id="{{ id }}" role="tabpanel"> <div class="row"> - <div class="col-{{ colsize }}"> - <ul class="list-group list-group-horizontal"> - <li class="list-group-item w-50"> - {{ _('Date') }} - </li> - <li class="list-group-item w-50"> - <p class="card-text">{{ time_dict['now'] }}</p> - </li> - </ul> - <ul class="list-group list-group-horizontal"> - <li class="list-group-item w-50"> - {{ _('Uptime') }} - </li> - <li class="list-group-item w-50"> - <p class="card-text">{{ time_dict['boot'] }}</p> - </li> - </ul> - <ul class="list-group list-group-horizontal"> - <li class="list-group-item w-50"> - {{ _('ogServer uptime') }} - </li> - <li class="list-group-item w-50"> - <p class="card-text">{{ time_dict['start'] }}</p> - </li> - </ul> - <ul class="list-group list-group-horizontal"> - <li class="list-group-item w-50"> - {{ _('Connected clients (ogClient)') }} - </li> - <li class="list-group-item w-50"> - <p class="card-text">{{ server.clients | length }}</p> - </li> - </ul> - <ul class="list-group list-group-horizontal"> - <li class="list-group-item w-50"> - {{ _('Number of images') }} - </li> - <li class="list-group-item w-50"> - <p class="card-text">{{ images | length }}</p> - </li> - </ul> - </div> <!-- disk stats --> <div class="col-{{ colsize }}"> @@ -263,14 +222,20 @@ {{ _('ogLive images') }} </div> <ul class="list-group"> - {% for oglive in oglive_list['oglive'] %} - <li class="list-group-item"> - {{ oglive['directory'] }} - {% if loop.index0 == oglive_list['default'] %} - ({{ _('default') }}) - {% endif %} - </li> - {% endfor %} + {% if oglive_list %} + {% for oglive in oglive_list['oglive'] %} + <li class="list-group-item"> + {{ oglive['directory'] }} + {% if loop.index0 == oglive_list['default'] %} + ({{ _('default') }}) + {% endif %} + </li> + {% endfor %} + {% else %} + <li class="list-group-item"> + No ogLive images available + </li> + {% endif %} </ul> </div> </div> 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(): |