class OrganizationCreateForm(FlaskForm): organization_name = StringField('Organization Name', validators=[DataRequired()]) def validate(self): if not FlaskForm.validate(self): return False # Cannot allow this Organization name, because it would cause issues on backend if self.organization_name.data == 'global': self.organization_name.errors.append('Cannot allow this Organization name for secret reasons, shush.') return False # TODO: remove these uniqueness checks after introduction of unique constraint # in ETCD storage class on backend client = get_kqueen_client(token=session['user']['token']) # Check if organization exists on backend response = client.organization.list() if response.status > 200: self.organization_name.errors.append('Can not contact backend at this time.') return False organizations = response.data organization_names = [org['name'] for org in organizations] organization_namespaces = [o['namespace'] for o in organizations] if self.organization_name.data in organization_names or slugify(self.organization_name.data) in organization_namespaces: self.organization_name.errors.append('Organization {} already exists.'.format(self.organization_name.data)) return False return True
class OrganizationCreateForm(FlaskForm): organization_name = StringField('Organization Name', validators=[DataRequired()]) def validate(self): if not FlaskForm.validate(self): return False # Cannot allow this Organization name, because it would cause issues on backend if self.organization_name.data == 'global': self.organization_name.errors.append( 'Cannot allow this Organization name for secret reasons, shush.' ) return False return True
class ClusterCreateForm(FlaskExtendableForm): name = StringField('Name', validators=[DataRequired()]) provisioner = SelectField('Provisioner', validators=[DataRequired()], choices=[], switch=True)
class ProvisionerCreateForm(FlaskExtendableForm): name = StringField('Name', validators=[DataRequired()]) engine = SelectField('Engine', choices=[], switch=True)
class LoginForm(FlaskExtendableForm): username = StringField('Username', validators=[DataRequired()]) password = PasswordField('Password', validators=[DataRequired()])