incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h...@apache.org
Subject [40/50] [abbrv] git commit: CLOUDSTACK-537: cloudstack UI - Advanced SG-enabled zone - Instance wizard UI: Support advanced zone with security groups
Date Mon, 21 Jan 2013 11:18:49 GMT
CLOUDSTACK-537: cloudstack UI - Advanced SG-enabled zone - Instance wizard UI: Support advanced
zone with security groups

For advanced zones with SG enabled, show both the add guest network
step as well as the add security group step.

reviewed-by: jessica


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

Branch: refs/heads/cloud-agent-with-openvswitch
Commit: 77bc04b90f134a6da89369ec3118f5cf041c7c95
Parents: ce4b49d
Author: Jessica Wang <jessica.wang@citrix.com>
Authored: Fri Jan 18 10:38:38 2013 -0800
Committer: Jessica Wang <jessica.wang@citrix.com>
Committed: Fri Jan 18 10:38:38 2013 -0800

----------------------------------------------------------------------
 ui/index.jsp                           |    2 +-
 ui/scripts/instanceWizard.js           |   31 ++++++++++++++++++++------
 ui/scripts/ui-custom/instanceWizard.js |   19 ++++++++++++++-
 3 files changed, 42 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/77bc04b9/ui/index.jsp
----------------------------------------------------------------------
diff --git a/ui/index.jsp b/ui/index.jsp
index a9b83e6..3fe6bad 100644
--- a/ui/index.jsp
+++ b/ui/index.jsp
@@ -220,7 +220,7 @@ under the License.
             </div>
 
             <!-- Step 5: Network -->
-            <div class="step network" wizard-step-id="network">
+            <div class="step network always-load" wizard-step-id="network">
               <!-- 5a: Network description -->
               <div class="wizard-step-conditional nothing-to-select">     
 								<p id="from_instance_page_1"><fmt:message key="message.zone.no.network.selection"/></p>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/77bc04b9/ui/scripts/instanceWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/instanceWizard.js b/ui/scripts/instanceWizard.js
index e4b1f31..65ec33f 100644
--- a/ui/scripts/instanceWizard.js
+++ b/ui/scripts/instanceWizard.js
@@ -268,25 +268,30 @@
       }
 
       if (selectedZoneObj.networktype == "Advanced") {  //Advanced zone. Show network list.
 
-				var $networkStep = $(".step.network:visible .nothing-to-select");		
+				var $networkStep = $(".step.network:visible .nothing-to-select");
+				var $networkStepContainer = $('.step.network:visible');
+
 				if(args.initArgs.pluginForm != null && args.initArgs.pluginForm.name == "vpcTierInstanceWizard")
{ //from VPC Tier chart
 				  step5ContainerType = 'nothing-to-select'; 					
 					$networkStep.find("#from_instance_page_1").hide();		
           $networkStep.find("#from_instance_page_2").hide();					
 					$networkStep.find("#from_vpc_tier").text("tier " + args.context.networks[0].name);	
			
 					$networkStep.find("#from_vpc_tier").show();					
-				}
-			  else { //from Instance page 
+				} else { //from Instance page
 				  if(selectedZoneObj.securitygroupsenabled != true) { // Advanced SG-disabled zone
 						step5ContainerType = 'select-network';
 						$networkStep.find("#from_instance_page_1").show();		
 						$networkStep.find("#from_instance_page_2").show();
 						$networkStep.find("#from_vpc_tier").text("");			
 						$networkStep.find("#from_vpc_tier").hide();
+					} else { // Advanced SG-enabled zone
+					  step5ContainerType = 'select-advanced-sg';
 					}
-					else { // Advanced SG-enabled zone
-					  step5ContainerType = 'select-security-group';					
-					}
+
+          if ($networkStepContainer.hasClass('next-use-security-groups')) {
+            $networkStepContainer.removeClass('repeat next-use-security-groups loaded');
+            step5ContainerType = 'select-security-group';
+          }
 				}
       }
       else { //Basic zone. Show securigy group list or nothing(when no SecurityGroup service
in guest network)
@@ -320,7 +325,7 @@
       }
 
       //step5ContainerType = 'nothing-to-select'; //for testing only, comment it out before
checking in
-      if(step5ContainerType == 'select-network') {
+      if(step5ContainerType == 'select-network' || step5ContainerType == 'select-advanced-sg')
{
         var defaultNetworkArray = [], optionalNetworkArray = [];
         var networkData = {
           zoneId: args.currentData.zoneid
@@ -379,6 +384,9 @@
         });
         //get network offerings (end)	***			
 
+        if (step5ContainerType == 'select-advanced-sg') {
+          $networkStepContainer.addClass('repeat next-use-security-groups');
+        }
 
         args.response.success({
           type: 'select-network',
@@ -449,6 +457,15 @@
       // Create a new VM!!!!
       var array1 = [];
 
+      //
+      // @jessica
+      // If using an advanced security group zone, get the guest networks like this
+      //
+      //   var myNetworks = $('.multi-wizard:visible form').data('my-networks');
+      //
+      // -- and get the security groups from args.data['security-groups']
+      //
+
       //step 1 : select zone
       array1.push("&zoneId=" + args.data.zoneid);
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/77bc04b9/ui/scripts/ui-custom/instanceWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui-custom/instanceWizard.js b/ui/scripts/ui-custom/instanceWizard.js
index d2724a5..f2cfd9c 100644
--- a/ui/scripts/ui-custom/instanceWizard.js
+++ b/ui/scripts/ui-custom/instanceWizard.js
@@ -598,6 +598,8 @@
               response: {
                 success: function(args) {
                   var vpcs = args.data.vpcs;
+                  var addClass = args.addClass;
+                  var removeClass = args.removeClass;
 
                   // Populate VPC drop-down
                   $vpcSelect.html('');
@@ -753,7 +755,8 @@
               )
             );
 
-            $targetStep.addClass('loaded');
+            if (!$targetStep.hasClass('repeat') &&
+                !$targetStep.hasClass('always-load')) $targetStep.addClass('loaded');
           }
 
           // Show launch vm button if last step
@@ -806,6 +809,14 @@
 
             //step 5 - select network
             if($activeStep.find('.wizard-step-conditional.select-network:visible').size()
> 0) {
+              var data = $activeStep.data('my-networks');
+
+              if (!data) {
+                $activeStep.closest('form').data('my-networks', cloudStack.serializeForm(
+                  $activeStep.closest('form')
+                )['my-networks']);
+              }
+
               if($activeStep.find('input[type=checkbox]:checked').size() == 0) {  //if no
checkbox is checked
                 cloudStack.dialog.notice({ message: 'message.step.4.continue' });
                 return false;
@@ -828,7 +839,11 @@
               }
             }
 
-            showStep($steps.filter(':visible').index() + 2);
+            if ($activeStep.hasClass('repeat')) {
+              showStep($steps.filter(':visible').index() + 1);
+            } else {
+              showStep($steps.filter(':visible').index() + 2);
+            }
 
             return false;
           }


Mime
View raw message