2017-03-08 13:53:09 -05:00
|
|
|
from flask_wtf import FlaskForm
|
|
|
|
from wtforms import StringField, PasswordField, BooleanField, SubmitField, SelectField, DecimalField
|
|
|
|
from wtforms import validators, ValidationError
|
|
|
|
from wtforms.fields.html5 import EmailField
|
|
|
|
|
|
|
|
|
|
|
|
class DeployForm(FlaskForm):
|
|
|
|
servername = StringField('Име/Домейн:', [validators.Regexp(message='пример: myservice1.com, myservice2.local', regex='^[a-zA-Z0-9][a-zA-Z0-9-_]{0,61}[a-zA-Z0-9]{0,1}\.([a-zA-Z]{1,6}|[a-zA-Z0-9-]{1,30}\.[a-zA-Z]{2,3})$')])
|
|
|
|
region = SelectField('Регион:')
|
|
|
|
vmpassword = StringField('Парола:', [validators.DataRequired()])
|
|
|
|
cpu = StringField('Процесорни ядра:')
|
|
|
|
mem = StringField('Памет:')
|
|
|
|
hdd = StringField('Дисково пространство:')
|
|
|
|
recipe = SelectField('Рецепта')
|
2017-06-01 18:27:17 -04:00
|
|
|
ipv4 = SelectField('Брой публични IP адреса', choices=[('1', '1'),('2', '2' ), ('3', '3')])
|
2017-03-08 13:53:09 -05:00
|
|
|
invite_key = StringField('Покана', [validators.DataRequired(), validators.Length(6,35)])
|
|
|
|
|
|
|
|
def validate_invite_key(self, field):
|
|
|
|
if field.data != 'inv1919':
|
|
|
|
raise ValidationError('Denied')
|
|
|
|
|
|
|
|
submit = SubmitField('Deploy')
|
|
|
|
|
2017-07-13 19:46:51 -04:00
|
|
|
class ActivateForm(FlaskForm):
|
2017-07-15 00:13:57 -04:00
|
|
|
period = SelectField('Deploy Period', choices=[(1, '1 Month'), (3, '3 Months'), (6, '6 Months'), (12, '1 Year'), (24, '2 Years')], coerce=int)
|
2017-07-13 19:46:51 -04:00
|
|
|
submit = SubmitField('Activate')
|