incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bfede...@apache.org
Subject [7/51] [abbrv] git commit: refs/heads/ui-quick-view-v2 - CLOUDSTACK-1343: cloudstack UI - baremetal - enable baremetal providers who are selected in the network offering.
Date Thu, 21 Feb 2013 21:45:20 GMT
CLOUDSTACK-1343: cloudstack UI - baremetal - enable baremetal providers who are selected in
the network offering.


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

Branch: refs/heads/ui-quick-view-v2
Commit: 48ec4395bd6c681bdaba548ea9956c652759adc0
Parents: b176654
Author: Jessica Wang <jessica.wang@citrix.com>
Authored: Wed Feb 20 15:13:46 2013 -0800
Committer: Jessica Wang <jessica.wang@citrix.com>
Committed: Wed Feb 20 15:13:46 2013 -0800

----------------------------------------------------------------------
 ui/scripts/installWizard.js |    1 +
 ui/scripts/zoneWizard.js    |   84 +++++++++++++++++++++++++++++++++-----
 2 files changed, 75 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/48ec4395/ui/scripts/installWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/installWizard.js b/ui/scripts/installWizard.js
index dff12a0..a5e13b8 100644
--- a/ui/scripts/installWizard.js
+++ b/ui/scripts/installWizard.js
@@ -278,6 +278,7 @@
           },
 					pluginFrom: {
 					  name: 'installWizard',
+						selectedNetworkOffering: selectedNetworkOffering,
 						selectedNetworkOfferingHavingSG: true
 					}						
         },

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/48ec4395/ui/scripts/zoneWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/zoneWizard.js b/ui/scripts/zoneWizard.js
index 60656e0..8b5171b 100755
--- a/ui/scripts/zoneWizard.js
+++ b/ui/scripts/zoneWizard.js
@@ -23,7 +23,10 @@
   var returnedPublicVlanIpRanges = []; //public VlanIpRanges returned by API
   var configurationUseLocalStorage = false;
 	var skipGuestTrafficStep = false;
-
+  var selectedNetworkOfferingObj = {};
+	var baremetalProviders = ["BaremetalDhcpProvider", "BaremetalPxeProvider", "BaremetaUserdataProvider"];
+	var selectedBaremetalProviders = [];
+	
   // Makes URL string for traffic label
   var trafficLabelParam = function(trafficTypeID, data, physicalNetworkID) {
     var zoneType = data.zone.networkType;
@@ -441,14 +444,16 @@
 										var thisNetworkOffering = this;
 										$(this.service).each(function(){
 											var thisService = this;
-																			
+																								
 											$(thisService.provider).each(function(){										
 												if(this.name == "Netscaler") {
-													thisNetworkOffering.havingNetscaler = true;
-													return false; //break each loop
+													thisNetworkOffering.havingNetscaler = true;													
+												}												
+												else if($.inArray(this.name, baremetalProviders) != -1) {												
+												  selectedBaremetalProviders.push(this.name);
 												}
-											});			
-											
+											});													
+										
 											if(thisService.name == "SecurityGroup") {
 												thisNetworkOffering.havingSG = true;
 											}
@@ -1787,10 +1792,19 @@
 																			
                                       if (result.jobstatus == 1) {
                                         //alert("configureVirtualRouterElement succeeded.");
-
+																		    
+																				if(args.data.pluginFrom != null && args.data.pluginFrom.name
== "installWizard") {
+																				  selectedNetworkOfferingObj = args.data.pluginFrom.selectedNetworkOffering;
+																				}
+																																							
+																				var data = {
+																				  id: virtualRouterProviderId,
+																					state: 'Enabled'																					
+																				};																				
+																																								
                                         $.ajax({
-                                          url: createURL("updateNetworkServiceProvider&state=Enabled&id="
+ virtualRouterProviderId),
-                                          dataType: "json",
+                                          url: createURL("updateNetworkServiceProvider"),
+                                          data: data,																	
                                           async: false,
                                           success: function(json) {    
 																						var enableVirtualRouterProviderIntervalID = setInterval(function()
{ 	
@@ -1806,7 +1820,57 @@
 																										clearInterval(enableVirtualRouterProviderIntervalID); 
 																										
                                                     if (result.jobstatus == 1) {
-                                                      //alert("Virtual Router Provider is
enabled");
+                                                      //alert("Virtual Router Provider is
enabled");																											  
+																											for(var i = 0; i < selectedBaremetalProviders.length; i++)
{																											 
+																												$.ajax({
+																													url: createURL("listNetworkServiceProviders"),
+																													data: {
+																													  name: selectedBaremetalProviders[i],
+																														physicalNetworkId: args.data.returnedBasicPhysicalNetwork.id

+																													},
+																													async: false,
+																													success: function(json) {																													  
+																														var items = json.listnetworkserviceprovidersresponse.networkserviceprovider;
+																														if(items != null && items.length > 0) {								
																					 
+																															var providerId = items[0].id;																												
																														
+																															$.ajax({
+																																url: createURL("updateNetworkServiceProvider"),
+																																data: {
+																																	id: providerId,
+																																	state: 'Enabled'																														
+																																},
+																																async: false,
+																																success: function(json) {																			
+																																	var updateNetworkServiceProviderIntervalID = setInterval(function()
{ 	
+																																		$.ajax({
+																																			url: createURL("queryAsyncJobResult&jobId=" + json.updatenetworkserviceproviderresponse.jobid),
+																																			dataType: "json",
+																																			success: function(json) {																												
						  
+																																				var result = json.queryasyncjobresultresponse;
+																																				if (result.jobstatus == 0) {
+																																					return; //Job has not completed
+																																				}
+																																				else {
+																																				  clearInterval(updateNetworkServiceProviderIntervalID);
			
+																																					if (result.jobstatus == 1) { //baremetal provider has
been enabled successfully      
+																																																																							
+																																					}
+																																					else if (result.jobstatus == 2) {																		
																			
+																																						alert(_s(result.jobresult.errortext));
+																																					}
+																																				}
+																																			},
+																																			error: function(XMLHttpResponse) {																			
																
+																																				alert(parseXMLHttpResponse(XMLHttpResponse));
+																																			}
+																																		});																															
+																																	}, g_queryAsyncJobResultInterval); 																				
													
+																																}
+																															});																															
+																														}
+																													}
+																												});																												
+																											}																											
 																											
 																											if(args.data.pluginFrom != null && args.data.pluginFrom.name
== "installWizard") {
 																											  selectedNetworkOfferingHavingSG = args.data.pluginFrom.selectedNetworkOfferingHavingSG;


Mime
View raw message