cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jessicaw...@apache.org
Subject git commit: cloudstack 3.0 UI - VPC - add network offering dialog - when service(s) has VPC Virtual Router as provider: (1) conserve mode is set to unchecked and grayed out. (2) redundant router capability checkbox is set to unchecked and grayed out. (3)
Date Fri, 20 Jul 2012 21:28:58 GMT
Updated Branches:
  refs/heads/vpc ee9074a17 -> 20db2e515


cloudstack 3.0 UI - VPC - add network offering dialog - when service(s) has VPC Virtual Router
as provider: (1) conserve mode is set to unchecked and grayed out. (2) redundant router capability
checkbox is set to unchecked and grayed out. (3) remove Firewall service, SecurityGroup service.


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

Branch: refs/heads/vpc
Commit: 20db2e515bd3fe33912765b8d54d3511dcbdba51
Parents: ee9074a
Author: Jessica Wang <jessica.wang@citrix.com>
Authored: Fri Jul 20 14:28:20 2012 -0700
Committer: Jessica Wang <jessica.wang@citrix.com>
Committed: Fri Jul 20 14:28:20 2012 -0700

----------------------------------------------------------------------
 ui/scripts/configuration.js |   84 ++++++++++++++++++++++++++++++++------
 1 files changed, 71 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/20db2e51/ui/scripts/configuration.js
----------------------------------------------------------------------
diff --git a/ui/scripts/configuration.js b/ui/scripts/configuration.js
index 766dcf3..85a169b 100644
--- a/ui/scripts/configuration.js
+++ b/ui/scripts/configuration.js
@@ -14,6 +14,7 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
+
 (function(cloudStack, $) {
 
   var requiredNetworkOfferingExists = false;
@@ -1032,7 +1033,9 @@
                 title: 'label.add.network.offering',               														
 								preFilter: function(args) {								  									
                   var $availability = args.$form.find('.form-item[rel=availability]');
-                  var $serviceOfferingId = args.$form.find('.form-item[rel=serviceOfferingId]');
+                  var $serviceOfferingId = args.$form.find('.form-item[rel=serviceOfferingId]');
								
+									var $conservemode = args.$form.find('.form-item[rel=conservemode]');										
+                  var $serviceSourceNatRedundantRouterCapabilityCheckbox = args.$form.find('.form-item[rel="service.SourceNat.redundantRouterCapabilityCheckbox"]');
                  		
                   var hasAdvancedZones = false;
 
                   // Check whether there are any advanced zones
@@ -1064,7 +1067,8 @@
                       $availability.hide();
                     }
 
-										//check whether to show or hide serviceOfferingId field										
+										
+										//when service(s) has Virtual Router as provider.....							
                     var havingVirtualRouterForAtLeastOneService = false;									
 										$(serviceCheckboxNames).each(function(){										  
 											var checkboxName = this;                      								
@@ -1076,17 +1080,48 @@
 													return false; //break each loop
 												}
 											}																					
-										});
-                    
-                    if(havingVirtualRouterForAtLeastOneService == true)
+										});                    
+                    if(havingVirtualRouterForAtLeastOneService == true) {
                       $serviceOfferingId.css('display', 'inline-block');
-                    else
+										}
+                    else {
                       $serviceOfferingId.hide();		
+										}
 
-	                  $(':ui-dialog').dialog('option', 'position', 'center');
+										
+										/*
+										when service(s) has VPC Virtual Router as provider:
+                    (1) conserve mode is set to unchecked and grayed out.	
+                    (2) redundant router capability checkbox is set to unchecked and grayed
out.	
+                    (3) remove Firewall service, SecurityGroup service. 									
+                    */										
+                    var havingVpcVirtualRouterForAtLeastOneService = false;									
+										$(serviceCheckboxNames).each(function(){										  
+											var checkboxName = this;                      								
+											if($("input[name='" + checkboxName + "']").is(":checked") == true) {									
	  
+											  var providerFieldName = checkboxName.replace(".isEnabled", ".provider"); //either
dropdown or input hidden field
+                        var providerName = $("[name='" + providerFieldName + "']").val();

+												if(providerName == "VpcVirtualRouter") {
+												  havingVpcVirtualRouterForAtLeastOneService = true;
+													return false; //break each loop
+												}
+											}																					
+										});                    
+                    if(havingVpcVirtualRouterForAtLeastOneService == true) {
+										  $conservemode.find("input[type=checkbox]").attr("disabled", "disabled"); 
+                      $conservemode.find("input[type=checkbox]").attr('checked', false);
	
 
+                      $serviceSourceNatRedundantRouterCapabilityCheckbox.find("input[type=checkbox]").attr("disabled",
"disabled"); 
+                      $serviceSourceNatRedundantRouterCapabilityCheckbox.find("input[type=checkbox]").attr('checked',
false);										
+										}
+                    else {
+                      $conservemode.find("input[type=checkbox]").removeAttr("disabled");

+                      $serviceSourceNatRedundantRouterCapabilityCheckbox.find("input[type=checkbox]").removeAttr("disabled");
									
+										}
+																				
+	                  $(':ui-dialog').dialog('option', 'position', 'center');
 										
-										//hide/show service fields upon guestIpType(Shared/Isolated) and zoneType(Advanced/Basic)
***** (begin) *****						
+										//hide/show service fields upon guestIpType(Shared/Isolated), zoneType(Advanced/Basic),
having VpcVirtualRouter or not ***** (begin) *****						
 										var serviceFieldsToHide = [];										
 										if($guestTypeField.val() == 'Shared') { //Shared network offering
 										  serviceFieldsToHide = [
@@ -1094,12 +1129,34 @@
 												'service.PortForwarding.isEnabled',													
 												'service.Firewall.isEnabled', 
 												'service.Vpn.isEnabled' 
-											];		
+											];	                      
+											if(havingVpcVirtualRouterForAtLeastOneService == true) { //add SecurityGroup to
to-hide-list
+											  serviceFieldsToHide.push('service.SecurityGroup.isEnabled');
+											}
+											else { //remove SecurityGroup from to-hide-list										 
+											  var temp = $.map(serviceFieldsToHide, function(item) {												  
+													if (item != 'service.SecurityGroup.isEnabled') {
+													  return item;
+													}
+												});		
+												serviceFieldsToHide = temp;
+											}		
 										}
 										else { //Isolated network offering 
 										  serviceFieldsToHide = [
 											  'service.SecurityGroup.isEnabled'
-											];
+											];											
+											if(havingVpcVirtualRouterForAtLeastOneService == true) { //add firewall to to-hide-list
+											  serviceFieldsToHide.push('service.Firewall.isEnabled');
+											}
+											else { //remove firewall from to-hide-list									 
+											  var temp = $.map(serviceFieldsToHide, function(item) {												  
+													if (item != 'service.Firewall.isEnabled') {
+													  return item;
+													}
+												});		
+												serviceFieldsToHide = temp;
+											}
 										}
                      											
 										//hide service fields that are included in serviceFieldsToHide
@@ -1129,14 +1186,14 @@
                         }													
 											}											
 										}
-										//hide/show service fields upon guestIpType(Shared/Isolated) and zoneType(Advanced/Basic)
***** (end) *****
+										//hide/show service fields upon guestIpType(Shared/Isolated), zoneType(Advanced/Basic),
having VpcVirtualRouter or not ***** (end) *****			
 																				
 										
 										//show LB Isolation dropdown only when (1)LB Service is checked (2)Service Provider
is Netscaler OR F5 (3)Guest IP Type is Isolated 									
 										if((args.$form.find('.form-item[rel=\"service.Lb.isEnabled\"]').find('input[type=checkbox]').is(':checked')
== true)
 										   &&(args.$form.find('.form-item[rel=\"service.Lb.provider\"]').find('select').val()
== 'Netscaler' 
 											    || args.$form.find('.form-item[rel=\"service.Lb.provider\"]').find('select').val()
== 'F5BigIp')
-											 ) {										  
+											 &&(args.$form.find('.form-item[rel=\"guestIpType\"]').find('select').val()
== 'Isolated')) {										  
 											args.$form.find('.form-item[rel=\"service.Lb.lbIsolationDropdown\"]').css('display',
'inline-block');	
 										}
 										else {										  
@@ -1174,7 +1231,7 @@
 
                   displayText: { label: 'label.description', validation: { required: true
} },
 
-                  networkRate: { label: 'label.network.rate' },
+                  networkRate: { label: 'label.network.rate.megabytes' },
 
 									/*
                   trafficType: {
@@ -1852,3 +1909,4 @@
   };
 	
 })(cloudStack, jQuery);
+


Mime
View raw message