From ec209480ea6cf287d9e12101ac744cdb22f0ecff Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Wed, 25 Sep 2024 12:44:07 +0200 Subject: templates: add free partition size in client details Add column with available space in partitions only in the client details views. --- ogcp/templates/actions/client_details.html | 1 + ogcp/templates/disk_inspector.html | 31 ++++++++++++++++++++++-------- 2 files changed, 24 insertions(+), 8 deletions(-) (limited to 'ogcp') diff --git a/ogcp/templates/actions/client_details.html b/ogcp/templates/actions/client_details.html index e462205..47b4721 100644 --- a/ogcp/templates/actions/client_details.html +++ b/ogcp/templates/actions/client_details.html @@ -38,6 +38,7 @@ {% set show_part_images = True %} +{% set show_free_size = True %} {% set readonly_disk_inspector = True %} {% include 'disk_inspector.html' %} diff --git a/ogcp/templates/disk_inspector.html b/ogcp/templates/disk_inspector.html index 2f19ad2..f3f190a 100644 --- a/ogcp/templates/disk_inspector.html +++ b/ogcp/templates/disk_inspector.html @@ -37,6 +37,9 @@ {{ _('Type') }} {{ _('Filesystem') }} {{ _('Size') }} (MiB) + {% if show_free_size is defined %} + {{ _('Free') }} (MiB) + {% endif %} {% if show_part_images is defined %} {{ _('Image') }} {% endif %} @@ -64,12 +67,13 @@ {% endif %} - {% if readonly_disk_inspector is defined %} - {{ partition.size(class_="form-control", oninput="handleEdit(this)", readonly="readonly") }} - {% else %} + {% if not readonly_disk_inspector is defined %} {{ partition.size(class_="form-control", oninput="handleEdit(this)") }} {% endif %} + {% if show_free_size is defined %} + + {% endif %} {% if show_part_images is defined %} {% endif %} @@ -291,12 +295,23 @@ let row = partitionsTable.find('tr').eq(i - 1); - row.find('td').eq(0).text(p.partition); - row.find('td').eq(1).find('select').val(p.code); - row.find('td').eq(2).find('select').val(p.filesystem); - row.find('td').eq(3).find('input').val(Math.floor(p.size / 1024)); + var idx = 0; + row.find('td').eq(idx++).text(p.partition); + row.find('td').eq(idx++).find('select').val(p.code); + row.find('td').eq(idx++).find('select').val(p.filesystem); + + {% if readonly_disk_inspector is defined %} + row.find('td').eq(idx++).text(Math.floor(p.size / 1024)); + {% else %} + row.find('td').eq(idx++).find('input').val(Math.floor(p.size / 1024)); + {% endif %} + + {% if show_free_size is defined %} + row.find('td').eq(idx++).text(Math.floor(p.free_size / (1024 * 1024))); + {% endif %} + {% if show_part_images is defined %} - row.find('td').eq(4).text(p.image); + row.find('td').eq(idx++).text(p.image); {% endif %} } -- cgit v1.2.3-18-g5258