Merge "Fix issues on create network and create port modals"
This commit is contained in:
commit
2e1118149b
@ -126,8 +126,8 @@ class CreateNetwork(forms.SelfHandlingForm):
|
|||||||
'data-switch-on': 'network_type',
|
'data-switch-on': 'network_type',
|
||||||
}))
|
}))
|
||||||
admin_state = forms.ThemableChoiceField(
|
admin_state = forms.ThemableChoiceField(
|
||||||
choices=[(True, _('UP')),
|
choices=[('True', _('UP')),
|
||||||
(False, _('DOWN'))],
|
('False', _('DOWN'))],
|
||||||
label=_("Admin State"))
|
label=_("Admin State"))
|
||||||
shared = forms.BooleanField(label=_("Shared"),
|
shared = forms.BooleanField(label=_("Shared"),
|
||||||
initial=False, required=False)
|
initial=False, required=False)
|
||||||
@ -288,9 +288,10 @@ class CreateNetwork(forms.SelfHandlingForm):
|
|||||||
def _clean_segmentation_id(self, data):
|
def _clean_segmentation_id(self, data):
|
||||||
network_type = data.get('network_type')
|
network_type = data.get('network_type')
|
||||||
if 'segmentation_id' in self._errors:
|
if 'segmentation_id' in self._errors:
|
||||||
if network_type not in self.nettypes_with_seg_id:
|
if (network_type not in self.nettypes_with_seg_id and
|
||||||
|
not self.data.get("segmentation_id")):
|
||||||
# In this case the segmentation ID is not required, so we can
|
# In this case the segmentation ID is not required, so we can
|
||||||
# ignore any errors.
|
# ignore the field is required error.
|
||||||
del self._errors['segmentation_id']
|
del self._errors['segmentation_id']
|
||||||
elif network_type in self.nettypes_with_seg_id:
|
elif network_type in self.nettypes_with_seg_id:
|
||||||
seg_id = data.get('segmentation_id')
|
seg_id = data.get('segmentation_id')
|
||||||
|
@ -43,8 +43,8 @@ class CreatePort(forms.SelfHandlingForm):
|
|||||||
name = forms.CharField(max_length=255,
|
name = forms.CharField(max_length=255,
|
||||||
label=_("Name"),
|
label=_("Name"),
|
||||||
required=False)
|
required=False)
|
||||||
admin_state = forms.ThemableChoiceField(choices=[(True, _('UP')),
|
admin_state = forms.ThemableChoiceField(choices=[('True', _('UP')),
|
||||||
(False, _('DOWN'))],
|
('False', _('DOWN'))],
|
||||||
label=_("Admin State"))
|
label=_("Admin State"))
|
||||||
device_id = forms.CharField(max_length=100, label=_("Device ID"),
|
device_id = forms.CharField(max_length=100, label=_("Device ID"),
|
||||||
help_text=_("Device ID attached to the port"),
|
help_text=_("Device ID attached to the port"),
|
||||||
|
@ -39,8 +39,8 @@ class UpdateNetwork(forms.SelfHandlingForm):
|
|||||||
widget=forms.TextInput(
|
widget=forms.TextInput(
|
||||||
attrs={'readonly': 'readonly'}))
|
attrs={'readonly': 'readonly'}))
|
||||||
admin_state = forms.ThemableChoiceField(
|
admin_state = forms.ThemableChoiceField(
|
||||||
choices=[(True, _('UP')),
|
choices=[('True', _('UP')),
|
||||||
(False, _('DOWN'))],
|
('False', _('DOWN'))],
|
||||||
required=False,
|
required=False,
|
||||||
label=_("Admin State"))
|
label=_("Admin State"))
|
||||||
shared = forms.BooleanField(label=_("Shared"), required=False)
|
shared = forms.BooleanField(label=_("Shared"), required=False)
|
||||||
|
@ -39,8 +39,8 @@ class UpdatePort(forms.SelfHandlingForm):
|
|||||||
label=_("Name"),
|
label=_("Name"),
|
||||||
required=False)
|
required=False)
|
||||||
admin_state = forms.ThemableChoiceField(
|
admin_state = forms.ThemableChoiceField(
|
||||||
choices=[(True, _('UP')),
|
choices=[('True', _('UP')),
|
||||||
(False, _('DOWN'))],
|
('False', _('DOWN'))],
|
||||||
label=_("Admin State"))
|
label=_("Admin State"))
|
||||||
failure_url = 'horizon:project:networks:detail'
|
failure_url = 'horizon:project:networks:detail'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user