From 411189e6ecb41b209b48993090bc5b8c8a14aa3b Mon Sep 17 00:00:00 2001 From: Javier Sánchez Parra Date: Fri, 26 Mar 2021 11:51:54 +0100 Subject: Add number of images to the dashboard Users want to easily know the number of images an ogServer has. --- ogcp/templates/dashboard.html | 20 +++++++++++++++----- ogcp/views.py | 5 ++++- 2 files changed, 19 insertions(+), 6 deletions(-) (limited to 'ogcp') diff --git a/ogcp/templates/dashboard.html b/ogcp/templates/dashboard.html index a9cea41..9c34768 100644 --- a/ogcp/templates/dashboard.html +++ b/ogcp/templates/dashboard.html @@ -1,12 +1,22 @@ {% extends 'base.html' %} {% block content %} -
-
- Connected clients (ogClient) +
+
+
+ Connected clients (ogClient) +
+
+

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

+
-
-

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

+
+
+ Number of images +
+
+

{{ images | length }}

+
{% endblock %} diff --git a/ogcp/views.py b/ogcp/views.py index 48ff798..44e9a6e 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -117,7 +117,10 @@ def index(): clients = None if current_user.is_authenticated: clients = get_clients() - return render_template('dashboard.html', clients=clients) + images_response = g.server.get('/images') + images = images_response.json()['images'] + return render_template('dashboard.html', clients=clients, + images=images) return render_template('base.html') @app.route('/login', methods=['GET', 'POST']) -- cgit v1.2.3-18-g5258