Fix to make edit guest network details async

This commit is contained in:
Brian Federle 2011-11-29 19:33:03 -08:00
parent ed854ba221
commit f253be7715
2 changed files with 15 additions and 38 deletions

View File

@ -258,36 +258,11 @@
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);
}
});
});
args.response.success({ _custom: { jobId: jobId }});
}
});
}
});
},
notification: { poll: pollAsyncJobResult }
}
},

View File

@ -26,6 +26,7 @@
_custom: notification._custom,
poll: function(args) {
var complete = args.complete;
var notificationError = args.error;
notification.poll({
_custom: args._custom,
@ -34,14 +35,10 @@
complete(args);
},
error: function(args) {
if (args.message) {
if (args.message) {
cloudStack.dialog.notice({ message: args.message });
}
error($.extend(errorArgs, args));
notificationError(args);
error($.extend(errorArgs, args));
complete(args);
}
return cloudStack.dialog.error;
}
});
}
@ -337,10 +334,11 @@
_custom: $detailView.data('_custom'),
context: $detailView.data('view-args').context,
response: {
success: function() {
success: function(args) {
var notificationArgs = {
section: id,
desc: 'Changed item properties'
desc: 'Changed item properties',
_custom: args._custom
};
if (!action.notification) {
@ -358,6 +356,10 @@
convertInputs($inputs);
$loading.remove();
}, [],
function() {
$loading.remove();
$inputs.closest('.detail-view').find('.toolbar .refresh').click();
}, []
);
}