summaryrefslogtreecommitdiffstats
path: root/ogcp/forms
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2021-07-28 17:14:51 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2021-07-28 17:19:51 +0200
commit5dd2b5c6dcd51438f71da05af399999ba512e0ca (patch)
treee9f10561cda118a143211dabc6a524c89e9fd446 /ogcp/forms
parent4b4edf4aeeed5d6177c1d78812a497e7ad1a206d (diff)
Add full scheme partitioning support
The initial "Partition & Format" (aka setup) form only allows to modify one partition at a time. This commit updates it to allow to modify the whole disk partition schema in one go, without pop-ups and transitions. This is a remake of the previous form using FieldList de WTForms and javascript to duplicate / remove FieldList adapted to the attributes available in WTForms.
Diffstat (limited to 'ogcp/forms')
-rw-r--r--ogcp/forms/action_forms.py32
1 files changed, 11 insertions, 21 deletions
diff --git a/ogcp/forms/action_forms.py b/ogcp/forms/action_forms.py
index 2286941..c5b4909 100644
--- a/ogcp/forms/action_forms.py
+++ b/ogcp/forms/action_forms.py
@@ -7,7 +7,7 @@
from wtforms import (
Form, SubmitField, HiddenField, SelectField, BooleanField, IntegerField,
- StringField, RadioField
+ StringField, RadioField, FormField, FieldList
)
from wtforms.validators import InputRequired
from flask_wtf import FlaskForm
@@ -21,9 +21,8 @@ class WOLForm(FlaskForm):
submit = SubmitField(label=_('Submit'))
class PartitionForm(FlaskForm):
- ips = HiddenField()
- disk = HiddenField()
- partition = HiddenField()
+ partition = SelectField(label=_('Partition'),
+ choices=range(1,10))
part_type = SelectField(label=_('Type'),
choices=[('LINUX', 'Linux'),
('NTFS', 'NTFS'),
@@ -31,28 +30,19 @@ class PartitionForm(FlaskForm):
fs = SelectField(label=_('Filesystem'),
choices=[('EXT4', 'EXT4'),
('NTFS', 'NTFS'),
- ('DISK', 'Disk'),
('EMPTY', 'Empty')])
size = IntegerField(label=_('Size (KB)'))
format_partition = BooleanField(label=_('Format'))
- modify = SubmitField(label=_('Modify'))
- delete = SubmitField(label=_('Delete'))
-
-class NewPartitionForm(FlaskForm):
+class SetupForm(FlaskForm):
ips = HiddenField()
- part_type = SelectField(label=_('Type'),
- choices=[('LINUX', 'Linux'),
- ('NTFS', 'NTFS'),
- ('EMPTY', 'Empty')])
- fs = SelectField(label=_('Filesystem'),
- choices=[('EXT4', 'EXT4'),
- ('NTFS', 'NTFS'),
- ('DISK', 'Disk'),
- ('EMPTY', 'Empty')])
- size = IntegerField(label=_('Size (KB)'))
- create = SubmitField(label=_('Create'))
-
+ disk = HiddenField()
+ disk_type = SelectField(label=_('Type'),
+ choices=[('MSDOS', 'MSDOS'),
+ ('GPT', 'GPT')])
+ partitions = FieldList(FormField(PartitionForm),
+ min_entries=1,
+ max_entries=10)
class HardwareForm(FlaskForm):
ips = HiddenField()