From 42dc44323e4cf0eaf0b563ba02f368942cf86e3d Mon Sep 17 00:00:00 2001 From: Daniel GarcĂ­a Moreno Date: Wed, 30 Jun 2021 12:40:22 +0200 Subject: 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. --- ogcp/forms/action_forms.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'ogcp/forms/action_forms.py') 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')) -- cgit v1.2.3-18-g5258