2018-01-11 08:19:59 -05:00
|
|
|
from flask_wtf import FlaskForm
|
|
|
|
from wtforms import StringField, PasswordField, BooleanField, SubmitField, SelectField, DecimalField
|
2018-04-21 20:29:54 -04:00
|
|
|
from flask_pagedown.fields import PageDownField
|
2018-01-11 08:19:59 -05:00
|
|
|
from wtforms import validators, ValidationError
|
|
|
|
from wtforms.fields.html5 import EmailField, DecimalRangeField
|
|
|
|
|
|
|
|
from .. import db
|
|
|
|
|
|
|
|
class OrderForm(FlaskForm):
|
2018-04-01 09:33:32 -04:00
|
|
|
region_choices = [(1, 'Plovdiv, Bulgaria'), (2, 'International Space Station')]
|
2018-02-21 11:01:35 -05:00
|
|
|
region = SelectField('Region:', choices=region_choices, coerce=int)
|
|
|
|
|
2018-04-02 08:44:33 -04:00
|
|
|
recipe_choices = [(1, 'RootVPS')]
|
|
|
|
recipe = SelectField('Type:', choices=recipe_choices, coerce=int)
|
2018-02-21 11:01:35 -05:00
|
|
|
|
2018-01-11 08:19:59 -05:00
|
|
|
cpu = DecimalRangeField('Processor Cores', default=2)
|
2018-03-22 18:15:50 -04:00
|
|
|
memory = DecimalRangeField('Memory', default=2048)
|
|
|
|
storage = DecimalRangeField('Storage', default=20)
|
2018-02-21 11:01:35 -05:00
|
|
|
|
2018-03-22 18:15:50 -04:00
|
|
|
alias = StringField('Name:', [validators.Regexp(message='ex.: 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})$'), validators.Length(6,64)])
|
2018-02-21 11:01:35 -05:00
|
|
|
|
|
|
|
submit = SubmitField('DEPLOY')
|
2018-01-11 08:19:59 -05:00
|
|
|
|
2018-04-22 18:00:05 -04:00
|
|
|
class MessageForm(FlaskForm):
|
|
|
|
line = PageDownField('Enter your message...', validators=[validators.DataRequired()])
|
|
|
|
submit = SubmitField('Submit')
|
2018-04-21 20:29:54 -04:00
|
|
|
|