templates: add free partition size in client details

Add column with available space in partitions only in the client
details views.
master
Alejandro Sirgo Rica 2024-09-25 12:44:07 +02:00
parent 9bf161fc7a
commit ec209480ea
2 changed files with 24 additions and 8 deletions

View File

@ -38,6 +38,7 @@
</div>
{% set show_part_images = True %}
{% set show_free_size = True %}
{% set readonly_disk_inspector = True %}
{% include 'disk_inspector.html' %}

View File

@ -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 %}
}