Skip to content

Commit a52889b

Browse files
committed
CS-16196: Fix VM wizard network selects
-Fixes case where 1 existing network is present, but cannot be unchecked when 'add new network' is checked -Fixes regression with multiple networks and VPC tiers present, where unchecking all regular networks will select the hidden VPC network reviewed-by: jessica
1 parent a319ac7 commit a52889b

1 file changed

Lines changed: 15 additions & 11 deletions

File tree

ui/scripts/ui-custom/instanceWizard.js

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,19 @@
106106
})
107107
.val(id)
108108
.click(function() {
109-
var $radio = $(this).closest('.select').find('input[type=radio]');
110-
111-
if ($(this).attr('type') == 'checkbox') {
112-
if ($(this).closest('.select-container').hasClass('single-select') ||
113-
!$(this).closest('.select').siblings().filter(':visible').size()) {
114-
$(this).closest('.select').siblings().find('input[type=checkbox]')
115-
.attr('checked', false);
109+
var $select = $(this).closest('.select');
110+
var $radio = $select.find('input[type=radio]');
111+
var $newNetwork = $(this).closest('.content').find('.select.new-network');
112+
var $otherSelects = $select.siblings().filter(':visible');
113+
var isCheckbox = $(this).attr('type') == 'checkbox';
114+
var isSingleSelect = $(this).closest('.select-container').hasClass('single-select');
115+
116+
if (isCheckbox) {
117+
if ((isSingleSelect || !$otherSelects.size()) &&
118+
$newNetwork.find('input[type=checkbox]').is(':unchecked')) {
119+
$otherSelects.find('input[type=checkbox]').attr('checked', false);
120+
121+
// Set as default
116122
$(this).closest('.select').find('input[type=radio]').click();
117123
}
118124
}
@@ -121,9 +127,7 @@
121127
if (!$radio.closest('.select').index()) {
122128
return false;
123129
} else {
124-
$radio
125-
.closest('.select')
126-
.siblings().filter(':first')
130+
$otherSelects.filter(':first')
127131
.find('input[type=radio]').click();
128132
}
129133
}
@@ -477,7 +481,7 @@
477481

478482
// Select another default if hiding field
479483
if ($newNetwork.hasClass('unselected')) {
480-
$step.find('input[type=radio]:first').click();
484+
$step.find('input[type=radio]:visible:first').click();
481485
} else {
482486
$newNetwork.find('input[type=radio]').click();
483487
}

0 commit comments

Comments
 (0)