You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by je...@apache.org on 2013/10/24 23:27:05 UTC

git commit: updated refs/heads/master to 2592452

Updated Branches:
  refs/heads/master ed0fbcc81 -> 259245200


CLOUDSTACK-4649: UI > Edit Instance, Edit Template > fix a bug that XenServer Tools Version 6.1+ field didn't get updated correctly.


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

Branch: refs/heads/master
Commit: 259245200d21fd642633dab54fc9e775ef2a12a5
Parents: ed0fbcc
Author: Jessica Wang <je...@apache.org>
Authored: Thu Oct 24 14:25:21 2013 -0700
Committer: Jessica Wang <je...@apache.org>
Committed: Thu Oct 24 14:25:21 2013 -0700

----------------------------------------------------------------------
 ui/scripts/instances.js | 34 +++++++++++++++++++++++++++++++---
 ui/scripts/templates.js | 32 ++++++++++++++++++++++++++++++--
 2 files changed, 61 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/25924520/ui/scripts/instances.js
----------------------------------------------------------------------
diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js
index 6e545fc..b729c4b 100644
--- a/ui/scripts/instances.js
+++ b/ui/scripts/instances.js
@@ -853,12 +853,40 @@
 			                		url: createURL('addResourceDetail'),
 			                		data: {
 			                			resourceType: 'uservm',
-			                			resourceId: 3,
+			                			resourceId: args.context.instances[0].id,
 			                			'details[0].key': 'hypervisortoolsversion',
 			                			'details[0].value': (args.data.xenserverToolsVersion61plus == "on") ? 'xenserver61' : 'xenserver56'
 			                		},
-			                		success: function(json) {
-			                			//do nothing  					                			
+			                		success: function(json) {			                			
+			                			 var jobId = json.addResourceDetailresponse.jobid;
+                                         var addResourceDetailIntervalID = setInterval(function() {
+                                             $.ajax({
+                                                 url: createURL("queryAsyncJobResult&jobid=" + jobId),
+                                                 dataType: "json",
+                                                 success: function(json) {
+                                                     var result = json.queryasyncjobresultresponse;
+                                                     
+                                                     if (result.jobstatus == 0) {
+                                                         return; //Job has not completed
+                                                     } else {
+                                                         clearInterval(addResourceDetailIntervalID);
+
+                                                         if (result.jobstatus == 1) {                                                        	 
+                                                        	 //do nothing                                                        	 
+                                                         } else if (result.jobstatus == 2) {
+                                                        	 cloudStack.dialog.notice({
+                                                                 message: "Failed to update XenServer Tools Version 6.1+ field. Error: " + _s(result.jobresult.errortext)
+                                                             });                                                             
+                                                         }
+                                                     }
+                                                 },
+                                                 error: function(XMLHttpResponse) {                                                    
+                                                     cloudStack.dialog.notice({
+                                                         message: "Failed to update XenServer Tools Version 6.1+ field. Error: " + parseXMLHttpResponse(XMLHttpResponse)
+                                                     });                                                          
+                                                 }
+                                             });
+                                         }, g_queryAsyncJobResultInterval);			                			   
 			                		}
 			                	});  					                					                	               
 						    }				      

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/25924520/ui/scripts/templates.js
----------------------------------------------------------------------
diff --git a/ui/scripts/templates.js b/ui/scripts/templates.js
index 922c87e..d4655e7 100644
--- a/ui/scripts/templates.js
+++ b/ui/scripts/templates.js
@@ -670,12 +670,40 @@
   					                		url: createURL('addResourceDetail'),
   					                		data: {
   					                			resourceType: 'template',
-  					                			resourceId: 1,
+  					                			resourceId: args.context.templates[0].id,
   					                			'details[0].key': 'hypervisortoolsversion',
   					                			'details[0].value': (args.data.xenserverToolsVersion61plus == "on") ? 'xenserver61' : 'xenserver56'
   					                		},
   					                		success: function(json) {
-  					                			//do nothing  					                			
+  					                			 var jobId = json.addResourceDetailresponse.jobid;
+  		                                         var addResourceDetailIntervalID = setInterval(function() {
+  		                                             $.ajax({
+  		                                                 url: createURL("queryAsyncJobResult&jobid=" + jobId),
+  		                                                 dataType: "json",
+  		                                                 success: function(json) {
+  		                                                     var result = json.queryasyncjobresultresponse;
+  		                                                     
+  		                                                     if (result.jobstatus == 0) {
+  		                                                         return; //Job has not completed
+  		                                                     } else {
+  		                                                         clearInterval(addResourceDetailIntervalID);
+
+  		                                                         if (result.jobstatus == 1) {                                                        	 
+  		                                                        	 //do nothing                                                        	 
+  		                                                         } else if (result.jobstatus == 2) {
+  		                                                        	 cloudStack.dialog.notice({
+  		                                                                 message: "Failed to update XenServer Tools Version 6.1+ field. Error: " + _s(result.jobresult.errortext)
+  		                                                             });                                                             
+  		                                                         }
+  		                                                     }
+  		                                                 },
+  		                                                 error: function(XMLHttpResponse) {                                                    
+  		                                                     cloudStack.dialog.notice({
+  		                                                         message: "Failed to update XenServer Tools Version 6.1+ field. Error: " + parseXMLHttpResponse(XMLHttpResponse)
+  		                                                     });                                                          
+  		                                                 }
+  		                                             });
+  		                                         }, g_queryAsyncJobResultInterval);		 					                			
   					                		}
   					                	});  					                					                	               
   								    }