Return-Path: X-Original-To: apmail-incubator-cloudstack-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-cloudstack-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6AA7ED411 for ; Thu, 29 Nov 2012 00:01:25 +0000 (UTC) Received: (qmail 74217 invoked by uid 500); 29 Nov 2012 00:01:19 -0000 Delivered-To: apmail-incubator-cloudstack-commits-archive@incubator.apache.org Received: (qmail 74144 invoked by uid 500); 29 Nov 2012 00:01:19 -0000 Mailing-List: contact cloudstack-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cloudstack-dev@incubator.apache.org Delivered-To: mailing list cloudstack-commits@incubator.apache.org Received: (qmail 73554 invoked by uid 99); 29 Nov 2012 00:01:19 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Nov 2012 00:01:18 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id D863B8131C2; Thu, 29 Nov 2012 00:01:18 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: prachidamle@apache.org To: cloudstack-commits@incubator.apache.org X-Mailer: ASF-Git Admin Mailer Subject: [34/50] [abbrv] 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 sel Message-Id: <20121129000118.D863B8131C2@tyr.zones.apache.org> Date: Thu, 29 Nov 2012 00:01:18 +0000 (UTC) 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/api_refactoring Commit: af79da5d80ed9f6ce723860ba2b344a31743b3c5 Parents: 7d89d92 Author: Jessica Wang Authored: Mon Nov 26 13:03:27 2012 -0800 Committer: Jessica Wang 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