mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-11-04 00:02:37 +01:00 
			
		
		
		
	changeServiceForVirtualMachine is not an async command since it merely does a database update for the VMs service offering. Change the UI to reflect this.
This commit is contained in:
		
							parent
							
								
									521cb762dc
								
							
						
					
					
						commit
						0143cbc1e1
					
				@ -593,47 +593,22 @@ function showInstancesTab(p_domainId, p_account) {
 | 
			
		||||
						       data: createURL("command=changeServiceForVirtualMachine&id="+vmId+"&serviceOfferingId="+$("#dialog_change_service_offering #change_service_offerings").val()+"&response=json"),
 | 
			
		||||
							dataType: "json",
 | 
			
		||||
							success: function(json) {						
 | 
			
		||||
								var jobId = json.changeserviceforvirtualmachineresponse.jobid;
 | 
			
		||||
					            var timerKey = "changeServiceForVirtualMachineJob_" + jobId;
 | 
			
		||||
					            $("body").everyTime(
 | 
			
		||||
						            5000,
 | 
			
		||||
						            timerKey,
 | 
			
		||||
						            function() {
 | 
			
		||||
							            $.ajax({
 | 
			
		||||
									   data: createURL("command=queryAsyncJobResult&jobId=" + jobId + "&response=json"),
 | 
			
		||||
								            dataType: "json",
 | 
			
		||||
								            success: function(json) {
 | 
			
		||||
									            var result = json.queryasyncjobresultresponse;
 | 
			
		||||
									            if (result.jobstatus == 0) {
 | 
			
		||||
										            return; //Job has not completed
 | 
			
		||||
									            } else {
 | 
			
		||||
										            $("body").stopTime(timerKey);
 | 
			
		||||
										            if (result.jobstatus == 1) { // Succeeded												            												            
 | 
			
		||||
								var virtualmachine = json.changeserviceforvirtualmachineresponse;
 | 
			
		||||
							        vmInstance.find("#vm_loading_container").hide();
 | 
			
		||||
				                                vmInstance.find(".row_loading").show();
 | 
			
		||||
				                                vmInstance.find(".loadingmessage_container .loadingmessage_top p").html("Your virtual instance has been upgraded.  Please restart your virtual instance for the new service offering to take effect.");
 | 
			
		||||
				                                vmInstance.find(".loadingmessage_container").fadeIn("slow");
 | 
			
		||||
								                        vmInstance.find("#vm_service").html("<strong>Service:</strong> " + fromdb(result.virtualmachine[0].serviceofferingname));		
 | 
			
		||||
								                        if (result.virtualmachine[0].haenable =='true') {
 | 
			
		||||
				                                vmInstance.find("#vm_service").html("<strong>Service:</strong> " + fromdb(virtualmachine.serviceofferingname));
 | 
			
		||||
				                                if (virtualmachine.haenable =='true') {
 | 
			
		||||
                                                                    vmInstance.find("#vm_ha").html("<strong>HA:</strong> Enabled");
 | 
			
		||||
			                                            vmInstance.find("#vm_action_ha").text("Disable HA");
 | 
			
		||||
		                                                } else {
 | 
			
		||||
			                                            vmInstance.find("#vm_ha").html("<strong>HA:</strong> Disabled");
 | 
			
		||||
			                                            vmInstance.find("#vm_action_ha").text("Enable HA");
 | 
			
		||||
		                                                }									                        
 | 
			
		||||
										            } else if (result.jobstatus == 2) { // Failed
 | 
			
		||||
											            $("#dialog_alert").html("<p>" + fromdb(result.jobresult) + "</p>").dialog("open");		
 | 
			
		||||
										            }
 | 
			
		||||
		                                                }
 | 
			
		||||
							},
 | 
			
		||||
					                error: function(XMLHttpResponse) {										
 | 
			
		||||
							    handleError(XMLHttpResponse);
 | 
			
		||||
									            $("body").stopTime(timerKey);										            
 | 
			
		||||
								            }
 | 
			
		||||
							            });
 | 
			
		||||
						            },
 | 
			
		||||
						            0
 | 
			
		||||
					            );									
 | 
			
		||||
		                                        }
 | 
			
		||||
						});
 | 
			
		||||
					}, 
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user