Esempio n. 1
0
 class AddServerManualForm(Form):
     make = QuerySelectField('Make',
                             allow_blank=True,
                             blank_text='Select Make',
                             query_factory=get_makes)
     model = QuerySelectField(
         'Model',
         allow_blank=True,
         blank_text='Select Model',
         query_factory=mongo_models.ServerModels.query.all)
     network_address = StringField('Management Mac/IP Address',
                                   validators=[Optional(),
                                               MacOrIP()])
     user_name = StringField('Username',
                             default='root',
                             validators=[Optional()])
     password = StringField('Password',
                            default='Not24Get',
                            validators=[Optional()])
     group = QuerySelectField(
         'Group',
         allow_blank=True,
         get_label='name',
         blank_text='Select Group',
         query_factory=mongo_models.Groups.query.filter({
             'mongo_id': {
                 '$in': group_ids
             }
         }).all,
         validators=[DataRequired()])
     room = QuerySelectField('Room',
                             allow_blank=False,
                             query_factory=mongo_models.Rooms.query.all)
Esempio n. 2
0
    class EditSwitchForm(Form):

        name = StringField('Name')
        group = QuerySelectField('Group',
                                 get_label='name',
                                 allow_blank=True,
                                 blank_text='None',
                                 query_factory=group_query_factory,
                                 default=default_group)
        location = QuerySelectField('Location',
                                    get_label='name',
                                    allow_blank=True,
                                    blank_text='None',
                                    query_factory=mongo_models.Rooms.query.all,
                                    default=switch.location)
Esempio n. 3
0
class AddEditRoomForm(Form):

    name = StringField('Name')
    type = QuerySelectField('Room Type',
                            allow_blank=False,
                            query_factory=mongo_models.RoomTypes.query.all)
    description = TextAreaField('Description')
Esempio n. 4
0
class AddEditRackModelForm(Form):

    make = QuerySelectField('Make',
                            get_label='name',
                            allow_blank=False,
                            blank_text='Select Manufacturer',
                            query_factory=mongo_models.Manufacturers.query.all)
    name = StringField('Model', validators=[DataRequired()])
    height = FloatField('Height', validators=[DataRequired()])
    width = FloatField('Width', validators=[DataRequired()])
    depth = FloatField('Depth', validators=[DataRequired()])
    units = QuerySelectField('Dimension Units',
                             get_label='unit',
                             blank_text='Select units',
                             query_factory=mongo_models.LengthUnits.query.all,
                             validators=[DataRequired()])
    number_of_units = IntegerField(validators=[DataRequired()])
Esempio n. 5
0
 class AddServerForm(Form):
     network_address = StringField('Management Mac/IP Address',
                                   validators=[DataRequired(),
                                               MacOrIP()])
     user_name = StringField('Username', default='root')
     password = StringField('Password', default='Not24Get')
     group = QuerySelectField(
         'Group',
         allow_blank=True,
         get_label='name',
         blank_text='Select Group',
         query_factory=mongo_models.Groups.query.filter(
             mongo_models.Groups.mongo_id.in_(*group_ids)).all,
         validators=[DataRequired()])
     room = QuerySelectField('Room',
                             allow_blank=False,
                             query_factory=mongo_models.Rooms.query.all)
Esempio n. 6
0
    class EditProjectForm(Form):

        name = StringField('Project Name', validators=[DataRequired()])
        group = QuerySelectField('Primary group',
                                 query_factory=mongo_models.Groups.query.all)
        owner = QuerySelectField('Owner',
                                 query_factory=mongo_models.Users.query.all,
                                 default=mongo_models.Users.query.filter_by(
                                     mongo_id=project.owner.mongo_id).first())
        start_date = DateField('Start Date')
        target_end_date = DateField('Target Completion Date')
        status = QuerySelectField(
            'Status',
            query_factory=mongo_models.ProjectStatusTypes.query.all,
            default=project.status)
        description = TextAreaField('Project Description')
        archived = BooleanField('Archived')
Esempio n. 7
0
    class EditServerForm(Form):

        name = StringField('Name')
        user_name = StringField('Username')
        password = StringField('Password')
        group = QuerySelectField('Group',
                                 get_label='name',
                                 allow_blank=True,
                                 blank_text='None',
                                 query_factory=group_query_factory,
                                 default=default_group)
        project = QuerySelectField('Project',
                                   get_label='name',
                                   allow_blank=True,
                                   blank_text='None',
                                   query_factory=project_query_factory,
                                   default=default_project)
Esempio n. 8
0
 class AddGroupMember(Form):
     member = QuerySelectField(
         'Member',
         get_label='user_name',
         allow_blank=True,
         blank_text='Select Member',
         query_factory=mongo_models.Users.query.filter(
             mongo_models.Users.mongo_id.nin(*member_list)).all,
         validators=[DataRequired()])
Esempio n. 9
0
    class AddProjectMemberForm(Form):

        member = QuerySelectField(
            'Member',
            allow_blank=True,
            blank_text='Select member',
            query_factory=mongo_models.Users.query.filter(
                mongo_models.Users.mongo_id.in_(*member_list)).all,
            validators=[DataRequired()])
Esempio n. 10
0
    class AddProjectForm(Form):

        name = StringField('Project Name', validators=[DataRequired()])
        group = QuerySelectField('Primary group',
                                 query_factory=groups,
                                 get_label='name')
        start_date = DateField('Start Date', format='%Y-%m-%d')
        target_end_date = DateField('Target Completion Date')
        description = TextAreaField('Project Description')
Esempio n. 11
0
 class AddEditRackForm(Form):
     location = QuerySelectField('Location',
                                 get_label='name',
                                 allow_blank=True,
                                 blank_text='Select Room',
                                 query_factory=mongo_models.Rooms.query.all,
                                 default=default_room)
     make = QuerySelectField(
         'Make',
         get_label='name',
         blank_text='Select Make',
         query_factory=mongo_models.Manufacturers.query.all)
     model = QuerySelectField(
         'Model',
         get_label='name',
         blank_text='Select Model',
         query_factory=mongo_models.RackModels.query.all)
     serial_number = StringField('Serial Number', validators=[Optional()])
     number = IntegerField('Rack Number', validators=[DataRequired()])
Esempio n. 12
0
    class AddProjectServerForm(Form):

        server = QuerySelectField(
            'Server',
            allow_blank=True,
            blank_text='Select server',
            get_label='name',
            query_factory=mongo_models.Servers.query.filter(
                mongo_models.Servers.mongo_id.in_(*servers)).all,
            validators=[DataRequired()])
Esempio n. 13
0
 class AddSwitchForm(Form):
     id = StringField('Switch ID', validators=[DataRequired()])
     model = QuerySelectField(
         'Model',
         allow_blank=False,
         blank_text='Select Model',
         query_factory=mongo_models.SwitchModels.query.all)
     group = QuerySelectField(
         'Group',
         allow_blank=True,
         get_label='name',
         blank_text='Select Group',
         query_factory=mongo_models.Groups.query.filter({
             'mongo_id': {
                 '$in': group_ids
             }
         }).all)
     location = QuerySelectField('Room',
                                 allow_blank=False,
                                 query_factory=mongo_models.Rooms.query.all)
Esempio n. 14
0
    class AddGroupServerForm(Form):
        def get_name(self):
            return self.name or self.host_name or self.mongo_id

        server = QuerySelectField(
            'Server',
            get_label=get_name,
            allow_blank=True,
            blank_text='Select Server',
            query_factory=mongo_models.Servers.query.filter(
                mongo_models.Servers.mongo_id.in_(*server_list)).all,
            validators=[DataRequired()])
Esempio n. 15
0
class DeployForm(Form):

    # helper methods
    def make_name(self):
        return '{} {}'.format(getattr(self, 'flavor'),
                              getattr(self, 'version'))

    # fields
    target = QuerySelectField('Target',
                              get_label='name',
                              allow_blank=True,
                              blank_text='Select a target',
                              validators=[required()],
                              get_pk=lambda x: x.id)
    os = QuerySelectField('OS',
                          query_factory=mongo_models.OS.query.filter_by(
                              validated=True).descending(
                                  mongo_models.OS.flavor).descending(
                                      mongo_models.OS.version).all,
                          get_label=make_name,
                          allow_blank=True,
                          blank_text='Select an OS',
                          validators=[required()])
Esempio n. 16
0
class AddSwitchModelForm(Form):
    make = QuerySelectField('Manufacturer',
                            allow_blank=False,
                            blank_text='Select Make',
                            query_factory=mongo_models.Manufacturers.query.all)
    name = StringField('Model', validators=[DataRequired()])