diff options
author | Alejandro Sirgo Rica <asirgo@soleta.eu> | 2024-09-25 12:44:07 +0200 |
---|---|---|
committer | Alejandro Sirgo Rica <asirgo@soleta.eu> | 2024-09-25 17:01:48 +0200 |
commit | ec209480ea6cf287d9e12101ac744cdb22f0ecff (patch) | |
tree | 09600d4b54c97b3ce17e5c2b8a4c3343df5f8eb4 | |
parent | 9bf161fc7a4e1b1372fcf32977dc3068f9eba8b1 (diff) |
templates: add free partition size in client details
Add column with available space in partitions only in the client
details views.
-rw-r--r-- | ogcp/templates/actions/client_details.html | 1 | ||||
-rw-r--r-- | ogcp/templates/disk_inspector.html | 31 |
2 files changed, 24 insertions, 8 deletions
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 @@ </div> {% 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 @@ <th>{{ _('Type') }}</th> <th>{{ _('Filesystem') }}</th> <th>{{ _('Size') }} (MiB)</th> + {% if show_free_size is defined %} + <th>{{ _('Free') }} (MiB)</th> + {% endif %} {% if show_part_images is defined %} <th>{{ _('Image') }}</th> {% endif %} @@ -64,12 +67,13 @@ {% endif %} </td> <td> - {% 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 %} </td> + {% if show_free_size is defined %} + <td></td> + {% endif %} {% if show_part_images is defined %} <td></td> {% 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 %} } |