From cf9def203c73a1df24fbe8a8aa7c199aa4f1b2c3 Mon Sep 17 00:00:00 2001 From: pengyuesheng Date: Mon, 18 Feb 2019 09:58:38 +0800 Subject: [PATCH] Marking CIDR as mandatory field on Add rule form in security_group panel When selecting the remote as CIDR, the CIDR value field is mandatory but isn't marked as mandatory. This patch marks it as mandatory. Change-Id: I2125813d6fb58e311b6bef821a88c78ab0fc6cfc Closes-Bug: #1816330 --- .../dashboards/project/security_groups/forms.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/openstack_dashboard/dashboards/project/security_groups/forms.py b/openstack_dashboard/dashboards/project/security_groups/forms.py index 4a551178fa..5d640b36da 100644 --- a/openstack_dashboard/dashboards/project/security_groups/forms.py +++ b/openstack_dashboard/dashboards/project/security_groups/forms.py @@ -230,17 +230,18 @@ class AddRule(forms.SelfHandlingForm): mask=True, widget=forms.TextInput( attrs={'class': 'switched', + 'data-required-when-shown': 'true', 'data-switch-on': 'remote', 'data-remote-cidr': _('CIDR')})) - security_group = forms.ChoiceField(label=_('Security Group'), - required=False, - widget=forms.ThemableSelectWidget( - attrs={ - 'class': 'switched', - 'data-switch-on': 'remote', - 'data-remote-sg': _('Security ' - 'Group')})) + security_group = forms.ChoiceField( + label=_('Security Group'), + required=False, + widget=forms.ThemableSelectWidget(attrs={ + 'class': 'switched', + 'data-required-when-shown': 'true', + 'data-switch-on': 'remote', + 'data-remote-sg': _('Security Group')})) # When cidr is used ethertype is determined from IP version of cidr. # When source group, ethertype needs to be specified explicitly. ethertype = forms.ChoiceField(label=_('Ether Type'),