summaryrefslogtreecommitdiffstats
path: root/ogcp/forms/action_forms.py
diff options
context:
space:
mode:
authorDaniel GarcĂ­a Moreno <danigm@soleta.eu>2021-06-30 12:40:22 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2021-06-30 17:19:55 +0200
commit42dc44323e4cf0eaf0b563ba02f368942cf86e3d (patch)
tree807a055b475f7358317239017b38872294a39491 /ogcp/forms/action_forms.py
parent288654722d061591ac834ecf9fb2310280473323 (diff)
Add new partition button in setup action
This patch adds a way to add a new partition to the setup.html template. This button opens a modal dialog with a new form and calls a new endpoint to create the new partition (this endpoint does nothing, it's needed to be implemented in the future). I've followed the initial design for this template, with one form per each partition, so every button will call a function and reload the page. It's possible to do all actions at once, but that will require a rework of this, to do that we can just define an unique form in the whole html, remove all the "Modify" buttons and add just one "Apply" button at the end. But maybe that option is a lot complex in the backend because will require to validate all the changes at once. This patch also improves the setup.html form without using flask-bootstrap and rendering the form in the template directly with the bootstrap4 classes.
Diffstat (limited to 'ogcp/forms/action_forms.py')
-rw-r--r--ogcp/forms/action_forms.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/ogcp/forms/action_forms.py b/ogcp/forms/action_forms.py
index 159c55a..0404e71 100644
--- a/ogcp/forms/action_forms.py
+++ b/ogcp/forms/action_forms.py
@@ -38,6 +38,22 @@ class PartitionForm(FlaskForm):
modify = SubmitField(label=_('Modify'))
delete = SubmitField(label=_('Delete'))
+
+class NewPartitionForm(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'))
+
+
class HardwareForm(FlaskForm):
ips = HiddenField()
refresh = SubmitField(label=_('Refresh'))