Merge "Fix workflow bug in "Create Network" dialog" into stable/mitaka

This commit is contained in:
Jenkins 2016-05-31 19:37:45 +00:00 committed by Gerrit Code Review
commit 4c7fa4421e
2 changed files with 17 additions and 10 deletions

View File

@ -320,25 +320,32 @@ horizon.addInitFunction(horizon.forms.init = function () {
visible = $switchable.parent().hasClass('themable-checkbox') ? $switchable.siblings('label').is(':visible') : $switchable.is(':visible'),
slug = $switchable.data('slug'),
checked = $switchable.prop('checked'),
hide_tab = String($switchable.data('hide-tab')).split(','),
hide_on = $switchable.data('hideOnChecked');
// If checkbox is hidden then do not apply any further logic
if (!visible) return;
// If the checkbox has hide-tab attribute then hide/show the tab
var i, len;
for (i = 0, len = hide_tab.length; i < len; i++) {
if ($switchable.data('hide-tab')){
var hide_tab = String($switchable.data('hide-tab')).split(',');
for (var i = 0, len = hide_tab.length; i < len; i++) {
var tab = $('*[data-target="#'+ hide_tab[i] +'"]').parent();
if(checked == hide_on) {
// If the checkbox is not checked then hide the tab
tab.hide();
} else if (!tab.is(':visible')) {
// If the checkbox is checked and the tab is currently hidden then show the tab again
tab.show();
}
}
// hide/show button-next or button-final
var $btnfinal = $('.button-final');
if(checked == hide_on) {
// If the checkbox is not checked then hide the tab
$('*[data-target="#'+ hide_tab[i] +'"]').parent().hide();
$('.button-next').hide();
$btnfinal.show();
$btnfinal.data('show-on-tab', $fieldset.prop('id'));
} else if (!$('*[data-target="#'+ hide_tab[i] +'"]').parent().is(':visible')) {
// If the checkbox is checked and the tab is currently hidden then show the tab again
$('*[data-target="#'+ hide_tab[i] +'"]').parent().show();
} else{
$btnfinal.hide();
$('.button-next').show();
$btnfinal.removeData('show-on-tab');

View File

@ -62,7 +62,7 @@ class CreateNetworkInfoAction(workflows.Action):
'action,'
'create_network__'
'createsubnetdetail'
'action,',
'action',
'data-hide-on-checked': 'false'
}),
initial=True,
@ -174,7 +174,7 @@ class CreateSubnetInfoAction(workflows.Action):
label=_("Gateway IP"),
widget=forms.TextInput(attrs={
'class': 'switched',
'data-switch-on': 'source gateway_ip',
'data-switch-on': 'gateway_ip',
'data-source-manual': _("Gateway IP")
}),
required=False,