From 8441d844d104900f987f874dbddb46aa2503ddda Mon Sep 17 00:00:00 2001 From: Javier Sánchez Parra Date: Tue, 30 Mar 2021 14:23:28 +0200 Subject: Add disk stats to the dashboard Add the following disk stats to the dashboard: * Disk size: shows the amount of total disk size in Gibibytes. * used: shows the amount of used disk size in Gibibytes. * available: shows the amount of free disk size in Gibibytes. * use(%): shows the amount of used disk size in percentage. --- ogcp/templates/dashboard.html | 33 +++++++++++++++++++++++++++++++++ ogcp/views.py | 3 ++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/ogcp/templates/dashboard.html b/ogcp/templates/dashboard.html index 518ae20..0f022c3 100644 --- a/ogcp/templates/dashboard.html +++ b/ogcp/templates/dashboard.html @@ -11,6 +11,39 @@
+
+ Disk stats +
+
+
    +
  • + Disk size +
  • +
  • + used +
  • +
  • + available +
  • +
  • + use(%) +
  • +
+
    +
  • + {{ disk['total'] // 2**30 }} Gbytes +
  • +
  • + {{ (disk['total'] - disk['free']) // 2**30 }} Gbytes +
  • +
  • + {{ disk['free'] // 2**30 }} Gbytes +
  • +
  • + {{ (((disk['total'] - disk['free']) / disk['total']) * 100)|int }}% +
  • +
+
Number of images
diff --git a/ogcp/views.py b/ogcp/views.py index 09454f7..e9a40c8 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -124,8 +124,9 @@ def index(): images_response = g.server.get('/images') images = images_response.json()['images'] images.sort(key=image_modified_date_from_str, reverse=True) + disk = images_response.json()['disk'] return render_template('dashboard.html', clients=clients, - images=images) + images=images, disk=disk) return render_template('base.html') @app.route('/login', methods=['GET', 'POST']) -- cgit v1.2.3-18-g5258