Browse Source

Add asterisk to conditionally required fields

https://review.openstack.org/#/c/552247/ introduced a way to
add asterisk mark to conditionally required fields.

This commit covers several known forms:
- Create Network / Create Subnet
- Create Port
- Attach Interface to Instance
- Add Security Group Rule

Change-Id: I809c23fd64dc2f379c3fdb585741c6b266ec5b1b
Closes-Bug: #1420370
Closes-Bug: #1292165
Closes-Bug: #1755131
Akihiro Motoki 1 year ago
parent
commit
f8196331ea

+ 1
- 0
openstack_dashboard/dashboards/project/instances/forms.py View File

@@ -299,6 +299,7 @@ class AttachInterface(forms.SelfHandlingForm):
299 299
         required=False,
300 300
         widget=forms.ThemableSelectWidget(attrs={
301 301
             'class': 'switched',
302
+            'data-required-when-shown': 'true',
302 303
             'data-switch-on': 'specification_method',
303 304
             'data-specification_method-port': _('Port'),
304 305
         }))

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

@@ -85,6 +85,7 @@ class CreatePortInfoAction(workflows.Action):
85 85
         required=False,
86 86
         widget=forms.ThemableSelectWidget(attrs={
87 87
             'class': 'switched',
88
+            'data-required-when-shown': 'true',
88 89
             'data-switch-on': 'specify_ip',
89 90
             'data-specify_ip-subnet_id': _('Subnet'),
90 91
         }))
@@ -95,6 +96,7 @@ class CreatePortInfoAction(workflows.Action):
95 96
         version=forms.IPv4 | forms.IPv6,
96 97
         widget=forms.TextInput(attrs={
97 98
             'class': 'switched',
99
+            'data-required-when-shown': 'true',
98 100
             'data-switch-on': 'specify_ip',
99 101
             'data-specify_ip-fixed_ip': _('Fixed IP Address'),
100 102
         }))

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

@@ -118,6 +118,7 @@ class CreateSubnetInfoAction(workflows.Action):
118 118
         label=_("Address pool"),
119 119
         widget=forms.ThemableSelectWidget(attrs={
120 120
             'class': 'switched switchable',
121
+            'data-required-when-shown': 'true',
121 122
             'data-slug': 'subnetpool',
122 123
             'data-switch-on': 'source',
123 124
             'data-source-subnetpool': _('Address pool')},
@@ -142,6 +143,7 @@ class CreateSubnetInfoAction(workflows.Action):
142 143
                          initial="",
143 144
                          widget=forms.TextInput(attrs={
144 145
                              'class': 'switched',
146
+                             'data-required-when-shown': 'true',
145 147
                              'data-switch-on': 'source',
146 148
                              'data-source-manual': _("Network Address"),
147 149
                          }),

+ 3
- 0
openstack_dashboard/dashboards/project/security_groups/forms.py View File

@@ -147,6 +147,7 @@ class AddRule(forms.SelfHandlingForm):
147 147
                                           "between 1 and 65535."),
148 148
                               widget=forms.TextInput(attrs={
149 149
                                   'class': 'switched',
150
+                                  'data-required-when-shown': 'true',
150 151
                                   'data-switch-on': 'range',
151 152
                                   'data-range-port': _('Port')}),
152 153
                               validators=[
@@ -158,6 +159,7 @@ class AddRule(forms.SelfHandlingForm):
158 159
                                                "between 1 and 65535."),
159 160
                                    widget=forms.TextInput(attrs={
160 161
                                        'class': 'switched',
162
+                                       'data-required-when-shown': 'true',
161 163
                                        'data-switch-on': 'range',
162 164
                                        'data-range-range': _('From Port')}),
163 165
                                    validators=[
@@ -169,6 +171,7 @@ class AddRule(forms.SelfHandlingForm):
169 171
                                              "between 1 and 65535."),
170 172
                                  widget=forms.TextInput(attrs={
171 173
                                      'class': 'switched',
174
+                                     'data-required-when-shown': 'true',
172 175
                                      'data-switch-on': 'range',
173 176
                                      'data-range-range': _('To Port')}),
174 177
                                  validators=[

Loading…
Cancel
Save