Ejemplo n.º 1
0
    def __init__(self, *args, **kwargs):
        rest_data = kwargs.pop('rest_data')
        super(CreateVMForm3, self).__init__(*args, **kwargs)

        self.fields['public_ip_id'] = forms.ChoiceField(
            choices=parsing.parse_ips(rest_data),
            required=False,
            widget=SelectWithDisabled(attrs=dict()),
            label=_('Assign IP address'),
            help_text=
            _('Public IP address - To get a new IP address go to: VM Resources -> Elastic IP addresses'
              ))

        self.fields['disk_list'] = forms.MultipleChoiceField(
            choices=parsing.parse_disks(rest_data, True),
            required=False,
            widget=CheckboxSelectMultipleWithDisabled,
            label=_('Attach disk volume'),
            help_text=_('Virtual disk - '))

        self.fields['iso_list'] = forms.ChoiceField(
            choices=parsing.parse_iso(rest_data),
            required=False,
            widget=SelectWithDisabled(attrs=dict()),
            label=_("Attach ISO image"))

        self.fields['vnc'] = forms.BooleanField(
            required=False,
            label=_("VNC"),
            widget=forms.CheckboxInput(attrs={'class': 'checkbox'}),
            help_text=_('VNC - Enable/Disable VNC redirection'))

        self.fields.keyOrder = ['public_ip_id', 'disk_list', 'iso_list', 'vnc']
Ejemplo n.º 2
0
    def __init__(self, *args, **kwargs):
        rest_data = kwargs.pop('rest_data')
        super(EditImageForm, self).__init__(*args, **kwargs)
        self.fields['platform'] = forms.ChoiceField(
            choices=image_platforms_reversed.items(), label=_('Platform'))
        self.fields['platform'].widget.attrs['class'] = 'medium'

        self.fields['disk_controller'] = forms.ChoiceField(
            choices=parsing.parse_generic_enabled(rest_data,
                                                  'disk_controllers'),
            widget=SelectWithDisabled(attrs=dict()),
            label=_('Bus'))
        self.fields['disk_controller'].widget.attrs['class'] = 'medium'

        self.fields['video_device'] = forms.ChoiceField(
            choices=parsing.parse_generic(rest_data, 'video_devices'),
            widget=SelectWithDisabled(attrs=dict()),
            label=_('Video'))
        self.fields['video_device'].widget.attrs['class'] = 'medium'

        self.fields['network_device'] = forms.ChoiceField(
            choices=parsing.parse_generic(rest_data, 'network_devices'),
            widget=SelectWithDisabled(attrs=dict()),
            label=_("Net"))
        self.fields['network_device'].widget.attrs['class'] = 'medium'

        self.fields.keyOrder = [
            'name', 'description', 'platform', 'disk_controller',
            'video_device', 'network_device'
        ]
Ejemplo n.º 3
0
 def __init__(self, *args, **kwargs):
     rest_data = kwargs.pop('rest_data')
     super(AssignIPForm, self).__init__(*args, **kwargs)
     self.fields['public_ip_id'] = forms.ChoiceField(
         choices=parsing.parse_ips(rest_data, False),
         initial=0,
         widget=SelectWithDisabled(attrs=dict({'class': 'medium'})),
         label=_("IP address"))
     self.fields['public_ip_id'].widget.attrs['class'] = 'medium'
     self.fields['lease_id'] = forms.ChoiceField(
         choices=parsing.parse_leases(rest_data),
         initial=0,
         widget=SelectWithDisabled(attrs=dict({'class': 'medium'})),
         label=_("Lease"))
     self.fields['lease_id'].widget.attrs['class'] = 'medium'
Ejemplo n.º 4
0
 def __init__(self, *args, **kwargs):
     rest_data = kwargs.pop('rest_data')
     super(RevokeDiskForm, self).__init__(*args, **kwargs)
     self.fields['storage_image_id'] = forms.ChoiceField(
         choices=parsing.parse_disks_from_vm(rest_data),
         initial=0,
         widget=SelectWithDisabled(attrs=dict({'class': 'medium'})),
         label=_('Disk'))
     self.fields['storage_image_id'].widget.attrs['class'] = 'medium'
Ejemplo n.º 5
0
    def __init__(self, *args, **kwargs):
        super(AddDiskForm, self).__init__(*args, **kwargs)
        rest_data = kwargs.pop('rest_data')

        self.fields['filesystem'] = forms.ChoiceField(
            choices=parsing.parse_generic(rest_data, 'supported_filesystems'),
            widget=SelectWithDisabled(attrs=dict()),
            label=_('File system'))
        self.fields['filesystem'].widget.attrs['class'] = 'medium'
Ejemplo n.º 6
0
    def __init__(self, *args, **kwargs):
        rest_data = kwargs.pop('rest_data')
        super(UploadISOForm, self).__init__(*args, **kwargs)

        self.fields['disk_controller'] = forms.ChoiceField(
            choices=parsing.parse_generic_enabled(rest_data,
                                                  'disk_controllers'),
            widget=SelectWithDisabled(attrs=dict()),
            label=_("Bus"))
        self.fields['disk_controller'].widget.attrs['class'] = 'medium'
Ejemplo n.º 7
0
    def __init__(self, request=None, *args, **kwargs):
        self.request = request
        rest_data = kwargs.pop('rest_data')
        super(CMAuthenticationForm, self).__init__(*args, **kwargs)

        self.fields['cm'] = forms.ChoiceField(choices=parsing.parse_cm_list(rest_data),
                                              initial=request.session['user'].default_cluster_id,
                                              widget=SelectWithDisabled(attrs=dict({'class': 'small'})),
                                              label=_("Cluster Manager"))
        self.fields.keyOrder = ['cm', 'password']
Ejemplo n.º 8
0
    def __init__(self, *args, **kwargs):
        rest_data = kwargs.pop('rest_data')
        self.session = kwargs.pop('session')
        super(CreateFarmForm2, self).__init__(*args, **kwargs)

        self.fields['head_template_id'] = forms.ChoiceField(
            choices=parsing.parse_template_names(rest_data),
            initial=0,
            widget=SelectWithDisabled(attrs=dict()),
            label=_('Head template'))

        self.fields['worker_template_id'] = forms.ChoiceField(
            choices=parsing.parse_template_names(rest_data),
            initial=0,
            widget=SelectWithDisabled(attrs=dict()),
            label=_('Worker node template'),
            help_text=_('Template of worker nodes - worker nodes parameters'))

        self.fields['count'] = forms.ChoiceField(
            choices=NumberChoice(24),
            initial=0,
            widget=forms.Select(attrs=dict({'class': 'xsmall'})),
            label=_('Number of worker nodes'),
            help_text=_('Number of worker nodes - (other than head)'))
Ejemplo n.º 9
0
    def __init__(self, *args, **kwargs):
        # not .pop() because CreateVMForm3 also needs it
        rest_data = kwargs['rest_data']
        super(CreateVMOnNodeForm, self).__init__(*args, **kwargs)

        self.fields['image_id'] = forms.ChoiceField(
            choices=parsing.parse_image_names(rest_data),
            widget=SelectWithDisabled(attrs=dict()),
            label=_("Image"),
            help_text=_(
                'Image file - From your public, private or group image pool'))

        self.fields['template_id'] = forms.ChoiceField(
            choices=parsing.parse_template_names(rest_data),
            widget=forms.Select(attrs=dict()),
            label=_("Template"),
            help_text=_('Template of machine - Virtual machine parameters'))

        self.fields.keyOrder = [
            'image_id', 'name', 'description', 'template_id', 'public_ip_id',
            'disk_list', 'iso_list', 'vnc'
        ]