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/forms/action_forms.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'ogcp/forms') diff --git a/ogcp/forms/action_forms.py b/ogcp/forms/action_forms.py index 5a2a4b1..b97ff4d 100644 --- a/ogcp/forms/action_forms.py +++ b/ogcp/forms/action_forms.py @@ -35,6 +35,7 @@ class PartitionForm(FlaskForm): render_kw={'readonly': True}, default=1) part_type = SelectField(label=_l('Type'), + validators=[InputRequired()], choices=[('LINUX', 'Linux'), ('NTFS', 'NTFS'), ('CACHE', 'CACHE'), @@ -52,6 +53,7 @@ class PartitionForm(FlaskForm): ('EMPTY', 'Empty')], default='EMPTY') fs = SelectField(label=_l('Filesystem'), + validators=[InputRequired()], choices=[('EXT4', 'EXT4'), ('NTFS', 'NTFS'), ('CACHE', 'CACHE'), @@ -59,23 +61,23 @@ class PartitionForm(FlaskForm): ('FAT32', 'FAT32'), ('EMPTY', 'Empty')], default='EMPTY') - size = IntegerField(label=_l('Size (KB)')) + size = IntegerField(label=_l('Size (KB)'), validators=[InputRequired()],) class SelectClientForm(FlaskForm): ips = HiddenField() selected_client = SelectField(label=_l('Select one client as reference to ' 'define the partition scheme')) - ok = SubmitField(label=_l('Submit')) + submit = SubmitField(label=_l('Select')) class SetupForm(FlaskForm): ips = HiddenField() - disk = HiddenField() + disk = SelectField(label='Disk', validate_choice=False) disk_type = SelectField(label=_l('Type'), choices=[('MSDOS', 'MBR'), ('GPT', 'GPT')]) partitions = FieldList(FormField(PartitionForm), min_entries=1, - max_entries=10) + max_entries=16) class HardwareForm(FlaskForm): ips = HiddenField() -- cgit v1.2.3-18-g5258