From 5cc411a9ee053d790df5b8d31ab8d8de83e2b50f Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Fri, 11 Oct 2013 10:26:31 -0700 Subject: [PATCH] LOUDSTACK-4060: UI > Instance Wizard > select security group step > when there is only one security group and the only one is 'default', check it automtically. --- ui/scripts/ui-custom/instanceWizard.js | 29 ++++++++++++++++---------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/ui/scripts/ui-custom/instanceWizard.js b/ui/scripts/ui-custom/instanceWizard.js index f4d4560b60f..f01bc3fed44 100644 --- a/ui/scripts/ui-custom/instanceWizard.js +++ b/ui/scripts/ui-custom/instanceWizard.js @@ -736,17 +736,24 @@ filterNetworkList(-1); // Security groups (alt. page) - $step.find('.security-groups .select-container').append( - makeSelects('security-groups', args.data.securityGroups, { - name: 'name', - desc: 'description', - id: 'id' - }, { - type: 'checkbox', - 'wizard-field': 'security-groups' - }) - ); - + var $sgSelects = makeSelects('security-groups', args.data.securityGroups, { + name: 'name', + desc: 'description', + id: 'id' + }, { + type: 'checkbox', + 'wizard-field': 'security-groups' + }); + $step.find('.security-groups .select-container').append($sgSelects); + + //If there is only one security group and the only one is 'default', make it selected by default + if ($sgSelects.length == 1) { + var $firstCheckbox = $sgSelects.eq(0); + if ($firstCheckbox.find('div .name').text() == 'default') { + $firstCheckbox.find('input:checkbox').click(); + } + } + originalValues(formData); checkShowAddNetwork($newNetwork); }