From 07ed925ab14afb046cb5de40c35bd2111ea12692 Mon Sep 17 00:00:00 2001 From: bfederle Date: Mon, 19 Dec 2011 11:35:26 -0800 Subject: [PATCH] bug 12614: Zone wizard update -Add support to filter network offerings based on whether security groups is checked; options then come from a separate 'securityGroupNetworkOfferings' object: args.response.success({ domains: domainObjs, // Non-security-group-enabled offerings networkOfferings: networkOfferingObjs, // Security group-enabled offerings securityGroupNetworkOfferings: [] }); -Remove old/unused fields from wizard --- ui/index-test.html | 39 ++++++++++++------------------ ui/index.jsp | 25 +++++++------------ ui/scripts/system.js | 10 +++++++- ui/scripts/ui-custom/zoneWizard.js | 34 +++++++++++++++++++++++--- 4 files changed, 65 insertions(+), 43 deletions(-) diff --git a/ui/index-test.html b/ui/index-test.html index 6f3219b9a72..8f90da40ceb 100644 --- a/ui/index-test.html +++ b/ui/index-test.html @@ -1,5 +1,5 @@ +"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> CloudStack @@ -433,22 +433,6 @@
Choose this network model if you wish to enable VLAN support. This network model provides the most flexibility in allowing administrators to provide custom network offerings such as providing firewall, vpn, or load balancer support as well as enabling direct vs virtual networking.
- -
-

Isolation mode

-
- - -
Choose this if you wish to use zone-wide VLANs to provide guest VM isolation.
-
-
- - -
Choose this if you wish to use security groups to provide guest VM isolation.
-
-
@@ -544,13 +528,22 @@
+ +
+
+ Enable security groups +
+
+ +
+
Network Offering
- +
@@ -571,7 +564,7 @@ Name
- +
@@ -581,7 +574,7 @@ Gateway
- +
@@ -591,7 +584,7 @@ Netmask
- +
@@ -601,9 +594,9 @@ Reserved IP
- + - - +
diff --git a/ui/index.jsp b/ui/index.jsp index 359c63d9ca9..699f2522f94 100644 --- a/ui/index.jsp +++ b/ui/index.jsp @@ -433,22 +433,6 @@
Choose this network model if you wish to enable VLAN support. This network model provides the most flexibility in allowing administrators to provide custom network offerings such as providing firewall, vpn, or load balancer support as well as enabling direct vs virtual networking.
- -
-

Isolation mode

-
- - -
Choose this if you wish to use zone-wide VLANs to provide guest VM isolation.
-
-
- - -
Choose this if you wish to use security groups to provide guest VM isolation.
-
-
@@ -544,6 +528,15 @@
+ +
+
+ Enable security groups +
+
+ +
+
diff --git a/ui/scripts/system.js b/ui/scripts/system.js index 0bc4da50c5f..387b5e2250e 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -2852,7 +2852,15 @@ } }); - args.response.success({domains: domainObjs, networkOfferings: networkOfferingObjs}); + args.response.success({ + domains: domainObjs, + + // Non-security-group-enabled offerings + networkOfferings: networkOfferingObjs, + + // Security group-enabled offerings + securityGroupNetworkOfferings: [] + }); }, // Step 3: Setup Pod diff --git a/ui/scripts/ui-custom/zoneWizard.js b/ui/scripts/ui-custom/zoneWizard.js index e2b41d116f1..1ffddb5cada 100644 --- a/ui/scripts/ui-custom/zoneWizard.js +++ b/ui/scripts/ui-custom/zoneWizard.js @@ -110,8 +110,9 @@ return $(this).index() <= targetIndex; }).toggleClass('active'); - // Load data provider for domain dropdowns - if (!$targetStep.hasClass('loaded') && (index == 2 || index == 4)) { + var loadData = function(options) { + if (!options) options = {}; + args.steps[targetIndex]({ response: { success: function(args) { @@ -121,14 +122,41 @@ }); $(args.networkOfferings).each(function() { - $('').val(this.id).html(this.name) + $('') + .val(this.id) + .html(this.name) .appendTo($targetStep.find('select.network-offering')); }); $targetStep.addClass('loaded'); + + // Security groups checkbox filters offering drop-down + var $securityGroupsEnabled = $wizard.find( + 'input[name=security-groups-enabled]' + ); + $securityGroupsEnabled.data('target-index', targetIndex); + $securityGroupsEnabled.change(function() { + var $check = $(this); + var $select = $targetStep.find('select.network-offering'); + var objs = $check.is(':checked') ? + args.securityGroupNetworkOfferings : args.networkOfferings; + + $select.children().remove(); + $(objs).each(function() { + $('') + .val(this.id) + .html(this.name) + .appendTo($select); + }); + }); } } }); + }; + + // Load data provider for domain dropdowns + if (!$targetStep.hasClass('loaded') && (index == 2 || index == 4)) { + loadData(); } setTimeout(function() {