summaryrefslogtreecommitdiffstats
path: root/ogcp/forms/action_forms.py
blob: a73b4d132c0b8e19badb74dce209c45f9a51e8f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
from wtforms import (
    Form, SubmitField, HiddenField, SelectField, BooleanField, IntegerField,
    StringField, RadioField
)
from wtforms.validators import InputRequired
from flask_wtf import FlaskForm
from flask_babel import _

class WOLForm(FlaskForm):
    ips = HiddenField()
    wol_type = SelectField(label=_('Type'),
                           choices=[('broadcast', 'Broadcast'),
                                    ('unicast', 'Unicast')])
    submit = SubmitField(label=_('Submit'))

class PartitionForm(FlaskForm):
    ips = HiddenField()
    disk = HiddenField()
    partition = HiddenField()
    part_type = SelectField(label=_('Type'),
                            choices=[('LINUX', 'Linux'),
                                     ('NTFS', 'NTFS'),
                                     ('EMPTY', 'Empty')])
    fs = SelectField(label=_('Filesystem'),
                     choices=[('EXT4', 'EXT4'),
                              ('NTFS', 'NTFS'),
                              ('EMPTY', 'Empty')])
    size = IntegerField(label=_('Size (KB)'))
    format_partition = BooleanField(label=_('Format'))
    modify = SubmitField(label=_('Modify'))
    delete = SubmitField(label=_('Delete'))

class HardwareForm(FlaskForm):
    ips = HiddenField()
    refresh = SubmitField(label=_('Refresh'))

class SoftwareForm(FlaskForm):
    ips = HiddenField()
    os = SelectField(label=_('Partition'), choices=[])
    view = SubmitField(label=_('View'))
    update = SubmitField(label=_('Update'))

class SessionForm(FlaskForm):
    ips = HiddenField()
    os = RadioField(label=_('Session'), choices=[])
    run = SubmitField(label=_('Run'))

class ImageRestoreForm(FlaskForm):
    ips = HiddenField()
    partition = SelectField(label=_('Partition'), choices=[])
    image = SelectField(label=_('Image'), choices=[])
    method = SelectField(label=_('Method'),
                         choices=[('UNICAST-CACHE', 'Unicast Cache'),
                                  ('UNICAST-DIRECT', 'Unicast Direct')])
    restore = SubmitField(label=_('Restore'))

class ClientDetailsForm(FlaskForm):
    name = StringField(label=_('Name'))
    ip = StringField(label=_('IP'))
    mac = StringField(label=_('MAC'))
    serial_number = StringField(label=_('Serial Number'))
    netmask = StringField(label=_('Netmask'))
    livedir = SelectField(label=_('ogLive'),
                          choices=[('ogLive', 'Default'),])
    remote = BooleanField(label=_('Remote'))
    maintenance = BooleanField(label=_('Maintenance'))
    netiface = SelectField(label=_('Interface'),
                           choices=[('eth0', 'eth0'),
                                    ('eth1', 'eth1'),
                                    ('eth2', 'eth2')])
    netdriver = SelectField(label=_('Driver'),
                            choices=[('generic', 'generic')])
    repo = SelectField(label=_('Repository'),
                       choices=[(1, 'Default')])
    room = SelectField(label=_('Room'))
    boot = SelectField(label=_('Boot Mode'))
    create = SubmitField(label=_('Create'))

class ImageCreateForm(FlaskForm):
    ip = HiddenField()
    os = SelectField(label=_('OS'), choices=[])
    name = StringField(label=_('Image name'),
                       validators=[InputRequired()])
    description = StringField(label=_('Description'))
    create = SubmitField(label=_('Create'))