Updated Branches:
  refs/heads/4.2 808b96070 -> 8b78c5f34

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.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8b78c5f3
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8b78c5f3
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8b78c5f3

Branch: refs/heads/4.2
Commit: 8b78c5f34e8279d78c2f4b6a55d69b4207cf1cbd
Parents: 808b960
Author: Jessica Wang <[email protected]>
Authored: Fri Oct 11 10:26:31 2013 -0700
Committer: Jessica Wang <[email protected]>
Committed: Fri Oct 11 10:26:41 2013 -0700

----------------------------------------------------------------------
 ui/scripts/ui-custom/instanceWizard.js | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8b78c5f3/ui/scripts/ui-custom/instanceWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui-custom/instanceWizard.js 
b/ui/scripts/ui-custom/instanceWizard.js
index f4d4560..f01bc3f 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);
                                 }

Reply via email to