cloudStack 3.0 new UI - NaaS - Physical Network - Edit action - hide spinning wheel on detail view when 2 API calls are finished.

This commit is contained in:
Jessica Wang 2011-11-18 10:40:39 -08:00
parent 2b61009ec5
commit 994d42920e
1 changed files with 39 additions and 13 deletions

View File

@ -256,24 +256,50 @@
actions: {
edit: {
label: 'Edit',
action: function(args) {
$.ajax({
url: createURL("updatePhysicalNetwork&id=" + args._custom.physicalNetworkObj.id + "&vlan=" + todb(args.data.vlan)),
dataType: "json",
success: function(json) {
}
});
action: function(args) {
$.ajax({
url: createURL("updateZone&id=" + args.context.zones[0].id + "&guestcidraddress=" + todb(args.data.guestcidraddress)),
dataType: "json",
success: function(json) {
async: false,
success: function(json) {
selectedZoneObj = json.updatezoneresponse.zone;
}
});
});
//args.response.success({data: item});
$.ajax({
url: createURL("updatePhysicalNetwork&id=" + args._custom.physicalNetworkObj.id + "&vlan=" + todb(args.data.vlan)),
dataType: "json",
success: function(json) {
var jobId = json.updatephysicalnetworkresponse.jobid;
var timerKey = "updatePhysicalNetworkJob_"+jobId;
$("body").everyTime(2000, timerKey, 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 {
$("body").stopTime(timerKey);
if (result.jobstatus == 1) {
var item = json.queryasyncjobresultresponse.jobresult.physicalnetwork;
args.response.success({data:item});
}
else if (result.jobstatus == 2) {
alert("updatePhysicalNetwork failed. Error: " + fromdb(result.jobresult.errortext));
}
}
},
error: function(XMLHttpResponse) {
var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
alert("updatePhysicalNetwork failed. Error: " + errorMsg);
}
});
});
}
});
}
}
},