cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jessicaw...@apache.org
Subject git commit: CLOUDSTACK-537: cloudstack UI - Advanced SG-Enabled zone - VM wizard - (1) step 5 - Show Security Groups instead of networks. (2) When Launch button is hit, Programmatically find a Shared network with Security Group in the selected zone, then
Date Mon, 26 Nov 2012 21:04:02 GMT
Updated Branches:
  refs/heads/master 7d89d928d -> af79da5d8


CLOUDSTACK-537: cloudstack UI - Advanced SG-Enabled zone - VM wizard - (1) step 5 - Show Security
Groups instead of networks. (2) When Launch button is hit, Programmatically find a Shared
network with Security Group in the selected zone, then pass it to deployVirtualMachine API.


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

Branch: refs/heads/master
Commit: af79da5d80ed9f6ce723860ba2b344a31743b3c5
Parents: 7d89d92
Author: Jessica Wang <jessica.wang@citrix.com>
Authored: Mon Nov 26 13:03:27 2012 -0800
Committer: Jessica Wang <jessica.wang@citrix.com>
Committed: Mon Nov 26 13:03:27 2012 -0800

----------------------------------------------------------------------
 ui/scripts/instanceWizard.js |   58 +++++++++++++++++++++++++++++++++----
 1 files changed, 52 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/af79da5d/ui/scripts/instanceWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/instanceWizard.js b/ui/scripts/instanceWizard.js
index b29ceaa..021fa8a 100644
--- a/ui/scripts/instanceWizard.js
+++ b/ui/scripts/instanceWizard.js
@@ -277,11 +277,16 @@
 					$networkStep.find("#from_vpc_tier").show();					
 				}
 			  else { //from Instance page 
-          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();
+				  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-security-group';					
+					}
 				}
       }
       else { //Basic zone. Show securigy group list or nothing(when no SecurityGroup service
in guest network)
@@ -320,7 +325,16 @@
         var networkData = {
           zoneId: args.currentData.zoneid
         };
-
+				
+				// step5ContainerType of Advanced SG-enabled zone is 'select-security-group', so won't
come into this block
+				/*
+				if(selectedZoneObj.networktype == 'Advanced' && selectedZoneObj.securitygroupsenabled
== true) {
+				  $.extend(networkData, {
+					  type: 'Shared'
+					});
+				}
+				*/
+				
         if (!(cloudStack.context.projects && cloudStack.context.projects[0])) {
           networkData.domainid = g_domainid;
           networkData.account = g_account;
@@ -532,6 +546,38 @@
 
         if(checkedSecurityGroupIdArray.length > 0)
           array1.push("&securitygroupids=" + checkedSecurityGroupIdArray.join(","));
+									
+				if(selectedZoneObj.networktype ==	"Advanced" && selectedZoneObj.securitygroupsenabled
== true) { // Advanced SG-enabled zone 		
+					var networkData = {
+						zoneId: selectedZoneObj.id,
+						type: 'Shared',
+						supportedServices: 'SecurityGroup'
+					};										
+					if (!(cloudStack.context.projects && cloudStack.context.projects[0])) {
+						networkData.domainid = g_domainid;
+						networkData.account = g_account;
+					}						
+					
+					var selectedNetworkObj = null;					
+					$.ajax({
+						url: createURL('listNetworks'),
+						data: networkData,
+						async: false,
+						success: function(json) {		              			
+							var networks = json.listnetworksresponse.network;
+							if(networks != null && networks.length > 0) {
+							  selectedNetworkObj = networks[0]; //each Advanced SG-enabled zone has only one guest
network that is Shared and has SecurityGroup service
+							}
+						}
+					});				 
+					if(selectedNetworkObj != null) {
+				    array1.push("&networkIds=" + selectedNetworkObj.id);	
+					}
+					else {
+					  alert('unable to find any Shared network with SecurityGroup service. Therefore, unable
to deploy VM in this Advanced SecurityGroup-enabled zone.');
+						return; 
+					}
+				}
       }
       else if (step5ContainerType == 'nothing-to-select') {	  
 				if(args.context.networks != null) { //from VPC tier


Mime
View raw message