summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkihiro Motoki <amotoki@gmail.com>2018-03-22 08:32:00 +0900
committerAkihiro Motoki <amotoki@gmail.com>2018-03-22 08:49:58 +0900
commitf8196331ea139f52b303eb87d0280152f06d9475 (patch)
tree23991cc45188bfd0b77f515cd1bcaf187ec0a8ce
parent0399e52e1e87a8a9fb7d14b7ae47f2348ee773d9 (diff)
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
Notes
Notes (review): Code-Review+1: Vladislav Kuzmin <vkuzmin@mirantis.com> Code-Review+1: Hanxiang Gao <gao.hanxiang@99cloud.net> Code-Review+2: Radomir Dopieralski <openstack@sheep.art.pl> Code-Review+2: Ivan Kolodyazhny <e0ne@e0ne.info> Workflow+1: Ivan Kolodyazhny <e0ne@e0ne.info> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Wed, 28 Mar 2018 16:04:48 +0000 Reviewed-on: https://review.openstack.org/555096 Project: openstack/horizon Branch: refs/heads/master
-rw-r--r--openstack_dashboard/dashboards/project/instances/forms.py1
-rw-r--r--openstack_dashboard/dashboards/project/networks/ports/workflows.py2
-rw-r--r--openstack_dashboard/dashboards/project/networks/workflows.py2
-rw-r--r--openstack_dashboard/dashboards/project/security_groups/forms.py3
4 files changed, 8 insertions, 0 deletions
diff --git a/openstack_dashboard/dashboards/project/instances/forms.py b/openstack_dashboard/dashboards/project/instances/forms.py
index 71b7295..dd232b0 100644
--- a/openstack_dashboard/dashboards/project/instances/forms.py
+++ b/openstack_dashboard/dashboards/project/instances/forms.py
@@ -299,6 +299,7 @@ class AttachInterface(forms.SelfHandlingForm):
299 required=False, 299 required=False,
300 widget=forms.ThemableSelectWidget(attrs={ 300 widget=forms.ThemableSelectWidget(attrs={
301 'class': 'switched', 301 'class': 'switched',
302 'data-required-when-shown': 'true',
302 'data-switch-on': 'specification_method', 303 'data-switch-on': 'specification_method',
303 'data-specification_method-port': _('Port'), 304 'data-specification_method-port': _('Port'),
304 })) 305 }))
diff --git a/openstack_dashboard/dashboards/project/networks/ports/workflows.py b/openstack_dashboard/dashboards/project/networks/ports/workflows.py
index 0a21145..1a49ac5 100644
--- a/openstack_dashboard/dashboards/project/networks/ports/workflows.py
+++ b/openstack_dashboard/dashboards/project/networks/ports/workflows.py
@@ -85,6 +85,7 @@ class CreatePortInfoAction(workflows.Action):
85 required=False, 85 required=False,
86 widget=forms.ThemableSelectWidget(attrs={ 86 widget=forms.ThemableSelectWidget(attrs={
87 'class': 'switched', 87 'class': 'switched',
88 'data-required-when-shown': 'true',
88 'data-switch-on': 'specify_ip', 89 'data-switch-on': 'specify_ip',
89 'data-specify_ip-subnet_id': _('Subnet'), 90 'data-specify_ip-subnet_id': _('Subnet'),
90 })) 91 }))
@@ -95,6 +96,7 @@ class CreatePortInfoAction(workflows.Action):
95 version=forms.IPv4 | forms.IPv6, 96 version=forms.IPv4 | forms.IPv6,
96 widget=forms.TextInput(attrs={ 97 widget=forms.TextInput(attrs={
97 'class': 'switched', 98 'class': 'switched',
99 'data-required-when-shown': 'true',
98 'data-switch-on': 'specify_ip', 100 'data-switch-on': 'specify_ip',
99 'data-specify_ip-fixed_ip': _('Fixed IP Address'), 101 'data-specify_ip-fixed_ip': _('Fixed IP Address'),
100 })) 102 }))
diff --git a/openstack_dashboard/dashboards/project/networks/workflows.py b/openstack_dashboard/dashboards/project/networks/workflows.py
index c9d23e8..8106778 100644
--- a/openstack_dashboard/dashboards/project/networks/workflows.py
+++ b/openstack_dashboard/dashboards/project/networks/workflows.py
@@ -118,6 +118,7 @@ class CreateSubnetInfoAction(workflows.Action):
118 label=_("Address pool"), 118 label=_("Address pool"),
119 widget=forms.ThemableSelectWidget(attrs={ 119 widget=forms.ThemableSelectWidget(attrs={
120 'class': 'switched switchable', 120 'class': 'switched switchable',
121 'data-required-when-shown': 'true',
121 'data-slug': 'subnetpool', 122 'data-slug': 'subnetpool',
122 'data-switch-on': 'source', 123 'data-switch-on': 'source',
123 'data-source-subnetpool': _('Address pool')}, 124 'data-source-subnetpool': _('Address pool')},
@@ -142,6 +143,7 @@ class CreateSubnetInfoAction(workflows.Action):
142 initial="", 143 initial="",
143 widget=forms.TextInput(attrs={ 144 widget=forms.TextInput(attrs={
144 'class': 'switched', 145 'class': 'switched',
146 'data-required-when-shown': 'true',
145 'data-switch-on': 'source', 147 'data-switch-on': 'source',
146 'data-source-manual': _("Network Address"), 148 'data-source-manual': _("Network Address"),
147 }), 149 }),
diff --git a/openstack_dashboard/dashboards/project/security_groups/forms.py b/openstack_dashboard/dashboards/project/security_groups/forms.py
index 731c6ef..8524138 100644
--- a/openstack_dashboard/dashboards/project/security_groups/forms.py
+++ b/openstack_dashboard/dashboards/project/security_groups/forms.py
@@ -147,6 +147,7 @@ class AddRule(forms.SelfHandlingForm):
147 "between 1 and 65535."), 147 "between 1 and 65535."),
148 widget=forms.TextInput(attrs={ 148 widget=forms.TextInput(attrs={
149 'class': 'switched', 149 'class': 'switched',
150 'data-required-when-shown': 'true',
150 'data-switch-on': 'range', 151 'data-switch-on': 'range',
151 'data-range-port': _('Port')}), 152 'data-range-port': _('Port')}),
152 validators=[ 153 validators=[
@@ -158,6 +159,7 @@ class AddRule(forms.SelfHandlingForm):
158 "between 1 and 65535."), 159 "between 1 and 65535."),
159 widget=forms.TextInput(attrs={ 160 widget=forms.TextInput(attrs={
160 'class': 'switched', 161 'class': 'switched',
162 'data-required-when-shown': 'true',
161 'data-switch-on': 'range', 163 'data-switch-on': 'range',
162 'data-range-range': _('From Port')}), 164 'data-range-range': _('From Port')}),
163 validators=[ 165 validators=[
@@ -169,6 +171,7 @@ class AddRule(forms.SelfHandlingForm):
169 "between 1 and 65535."), 171 "between 1 and 65535."),
170 widget=forms.TextInput(attrs={ 172 widget=forms.TextInput(attrs={
171 'class': 'switched', 173 'class': 'switched',
174 'data-required-when-shown': 'true',
172 'data-switch-on': 'range', 175 'data-switch-on': 'range',
173 'data-range-range': _('To Port')}), 176 'data-range-range': _('To Port')}),
174 validators=[ 177 validators=[