diff --git a/ui/scripts/system.js b/ui/scripts/system.js index 7f735874f6c..7fb5308d8e5 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -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 } } }, diff --git a/ui/scripts/ui/widgets/detailView.js b/ui/scripts/ui/widgets/detailView.js index 630b2e194ea..42ccb91473b 100644 --- a/ui/scripts/ui/widgets/detailView.js +++ b/ui/scripts/ui/widgets/detailView.js @@ -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(); }, [] ); }