From d00e437b8d76bc32732643a92f0ea32fbe0b7901 Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Thu, 29 Aug 2024 11:55:52 +0200 Subject: ogcp: add support for multi-disk partition and format Add support for selecting different disks in the disk inspector. Add disk_inspector.html as a template to show the disk contents of a client. The view can define the variable readonly_disk_inspector to make the view non editable. Use disk_inspector.html in the following views: - client details - partition and format Update code to obtain the partitions of a client to better fit the requirements of disk_inspector.html Remove code to setup the SetupForm as the contents of the disks are now dynamically loaded through javascript. --- ogcp/templates/actions/client_details.html | 29 +--- ogcp/templates/actions/select_client.html | 42 ++++++ ogcp/templates/actions/setup.html | 226 +---------------------------- 3 files changed, 47 insertions(+), 250 deletions(-) (limited to 'ogcp/templates/actions') diff --git a/ogcp/templates/actions/client_details.html b/ogcp/templates/actions/client_details.html index a718450..6bccace 100644 --- a/ogcp/templates/actions/client_details.html +++ b/ogcp/templates/actions/client_details.html @@ -37,31 +37,10 @@ -{% if setup|length > 0 %} - - - - - - - - - - - - - {% for entry in setup %} - - - - - - - - {% endfor %} - -
{{_('Partition')}}{{_('Type')}}{{_('Filesystem')}}{{_('Size')}} (MiB){{_('Image')}}
{{ entry.partition }}{{ entry.code }}{{ entry.filesystem }}{{ entry.size // 1024}}{{ entry.image }}
-{% endif %} +{% set show_part_images = True %} +{% set readonly_disk_inspector = True %} +{% include 'disk_inspector.html' %} + {% include 'cache_inspector.html' %} diff --git a/ogcp/templates/actions/select_client.html b/ogcp/templates/actions/select_client.html index 0415621..a44c551 100644 --- a/ogcp/templates/actions/select_client.html +++ b/ogcp/templates/actions/select_client.html @@ -17,6 +17,48 @@ {{ macros.cmd_selected_clients(selected_clients) }} +{% if common_disk_data|length > 0 %} + +
+ + + + + + + + + + + {% for disk, data in common_disk_data.items() %} + {% for size, ips in data.inventory.items() %} + + {% if loop.first %} + + {% endif %} + + + + {% endfor %} + + {% endfor %} + +
{{ _('Disk') }}{{ _('Size (MiB)') }}{{ _('Clients') }}
{{ disk }} + {% if size == data.common_size %} + {{ size // 1024 }} + {% else %} + {{ size // 1024 }} + {% endif %} + + {% for ip in ips %} +
{{ ip }}
+ {% endfor %} +
+

{{ _('Note: the disk size in bold represents the selected common size for partitioning') }}

+
+ +{% endif %} + {{ wtf.quick_form(form, action=url_for('action_setup_show'), method='get', diff --git a/ogcp/templates/actions/setup.html b/ogcp/templates/actions/setup.html index 934d72f..6ae7c15 100644 --- a/ogcp/templates/actions/setup.html +++ b/ogcp/templates/actions/setup.html @@ -9,230 +9,6 @@

{{_('Partition and Format')}}

-
- - -
- -
- - - - - - - - - - - - - {{ form.hidden_tag() }} - - - - -
{{ _('Disk') }}{{ _('Partition Table Type') }}{{ _('Total Disk Size') }} (MiB)
- - {{ form.disk_type(class_="form-control") }}{{ disk_size }}
- - - - - - - - - - - - - {% for partition in form.partitions %} - - {{ partition.hidden_tag() }} - - - - - - - {% endfor %} - -
{{ _('Partition') }}{{ _('Type') }}{{ _('Filesystem') }}{{ _('Size') }} (MiB)
{{ partition.partition.data }}{{ partition.part_type(class_="form-control") }}{{ partition.fs(class_="form-control") }}{{ partition.size(class_="form-control", oninput="handleEdit(this)") }} - -
-
- - - - - -
-
- {{ _('Partition graph') }} -
-
- -
-
- - - - - - +{% include 'disk_inspector.html' %} {% endblock %} -- cgit v1.2.3-18-g5258