Browse Source

Merge "Fix issues on create network and create port modals"

Jenkins 2 years ago
parent
commit
2e1118149b

+ 5
- 4
openstack_dashboard/dashboards/admin/networks/forms.py View File

@@ -126,8 +126,8 @@ class CreateNetwork(forms.SelfHandlingForm):
126 126
             'data-switch-on': 'network_type',
127 127
         }))
128 128
     admin_state = forms.ThemableChoiceField(
129
-        choices=[(True, _('UP')),
130
-                 (False, _('DOWN'))],
129
+        choices=[('True', _('UP')),
130
+                 ('False', _('DOWN'))],
131 131
         label=_("Admin State"))
132 132
     shared = forms.BooleanField(label=_("Shared"),
133 133
                                 initial=False, required=False)
@@ -288,9 +288,10 @@ class CreateNetwork(forms.SelfHandlingForm):
288 288
     def _clean_segmentation_id(self, data):
289 289
         network_type = data.get('network_type')
290 290
         if 'segmentation_id' in self._errors:
291
-            if network_type not in self.nettypes_with_seg_id:
291
+            if (network_type not in self.nettypes_with_seg_id and
292
+                    not self.data.get("segmentation_id")):
292 293
                 # In this case the segmentation ID is not required, so we can
293
-                # ignore any errors.
294
+                # ignore the field is required error.
294 295
                 del self._errors['segmentation_id']
295 296
         elif network_type in self.nettypes_with_seg_id:
296 297
             seg_id = data.get('segmentation_id')

+ 2
- 2
openstack_dashboard/dashboards/admin/networks/ports/forms.py View File

@@ -43,8 +43,8 @@ class CreatePort(forms.SelfHandlingForm):
43 43
     name = forms.CharField(max_length=255,
44 44
                            label=_("Name"),
45 45
                            required=False)
46
-    admin_state = forms.ThemableChoiceField(choices=[(True, _('UP')),
47
-                                                     (False, _('DOWN'))],
46
+    admin_state = forms.ThemableChoiceField(choices=[('True', _('UP')),
47
+                                                     ('False', _('DOWN'))],
48 48
                                             label=_("Admin State"))
49 49
     device_id = forms.CharField(max_length=100, label=_("Device ID"),
50 50
                                 help_text=_("Device ID attached to the port"),

+ 2
- 2
openstack_dashboard/dashboards/project/networks/forms.py View File

@@ -39,8 +39,8 @@ class UpdateNetwork(forms.SelfHandlingForm):
39 39
                                  widget=forms.TextInput(
40 40
                                      attrs={'readonly': 'readonly'}))
41 41
     admin_state = forms.ThemableChoiceField(
42
-        choices=[(True, _('UP')),
43
-                 (False, _('DOWN'))],
42
+        choices=[('True', _('UP')),
43
+                 ('False', _('DOWN'))],
44 44
         required=False,
45 45
         label=_("Admin State"))
46 46
     shared = forms.BooleanField(label=_("Shared"), required=False)

+ 2
- 2
openstack_dashboard/dashboards/project/networks/ports/forms.py View File

@@ -39,8 +39,8 @@ class UpdatePort(forms.SelfHandlingForm):
39 39
                            label=_("Name"),
40 40
                            required=False)
41 41
     admin_state = forms.ThemableChoiceField(
42
-        choices=[(True, _('UP')),
43
-                 (False, _('DOWN'))],
42
+        choices=[('True', _('UP')),
43
+                 ('False', _('DOWN'))],
44 44
         label=_("Admin State"))
45 45
     failure_url = 'horizon:project:networks:detail'
46 46
 

Loading…
Cancel
Save