summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2021-03-30 14:23:28 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2021-05-20 18:44:30 +0200
commit8441d844d104900f987f874dbddb46aa2503ddda (patch)
tree91dce13e312ec93e4a6c01eb9ce313eb813fdcf6
parent7f0d1ab287285e3903ff5507d68565aa393de3a0 (diff)
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.
-rw-r--r--ogcp/templates/dashboard.html33
-rw-r--r--ogcp/views.py3
2 files changed, 35 insertions, 1 deletions
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
@@ -12,6 +12,39 @@
</div>
<div class="m-4 w-25 card text-center">
<div class="card-header">
+ Disk stats
+ </div>
+ <div class="card-body">
+ <ul class="list-group list-group-horizontal">
+ <li class="list-group-item w-50">
+ Disk size
+ </li>
+ <li class="list-group-item w-50">
+ used
+ </li>
+ <li class="list-group-item w-50">
+ available
+ </li>
+ <li class="list-group-item w-50">
+ use(%)
+ </li>
+ </ul>
+ <ul class="list-group list-group-horizontal">
+ <li class="list-group-item w-50">
+ {{ disk['total'] // 2**30 }} Gbytes
+ </li>
+ <li class="list-group-item w-50">
+ {{ (disk['total'] - disk['free']) // 2**30 }} Gbytes
+ </li>
+ <li class="list-group-item w-50">
+ {{ disk['free'] // 2**30 }} Gbytes
+ </li>
+ <li class="list-group-item w-50">
+ {{ (((disk['total'] - disk['free']) / disk['total']) * 100)|int }}%
+ </li>
+ </ul>
+ </div>
+ <div class="card-header">
Number of images
</div>
<div class="card-body">
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'])