bug 13922

-Fix enable static NAT never completing if detail view was not visible
 -- caused by JS error in widget

-If detail view isn't visible anymore, don't show post-enable/disable
 NAT dialog which refreshes list view
This commit is contained in:
Brian Federle 2012-02-22 12:04:13 -08:00
parent 99b0fbbdcb
commit 84b18473e7
3 changed files with 22 additions and 9 deletions

View File

@ -1225,7 +1225,9 @@
}
});
ipChangeNotice();
if (args._custom.$detailView.is(':visible')) {
ipChangeNotice();
}
}
}
},
@ -1254,7 +1256,11 @@
return ['enableStaticNAT'];
};
},
onComplete: ipChangeNotice
onComplete: function(args, _custom) {
if (_custom.$detailView.is(':visible')) {
ipChangeNotice();
}
}
}
});
},

View File

@ -41,7 +41,7 @@ var pollAsyncJobResult = function(args) {
return; //Job has not completed
}
else {
if (result.jobstatus == 1) { // Succeeded
if (result.jobstatus == 1) { // Succeeded
if(args._custom.getUpdatedItem != null && args._custom.getActionFilter != null) {
args.complete({
data: args._custom.getUpdatedItem(json),
@ -64,7 +64,7 @@ var pollAsyncJobResult = function(args) {
}
if (args._custom.onComplete) {
args._custom.onComplete(json);
args._custom.onComplete(json, args._custom);
}
}
else if (result.jobstatus == 2) { // Failed

View File

@ -82,9 +82,11 @@
if (customAction && !noAdd) {
customAction({
context: context,
$detailView: $detailView,
complete: function(args) {
// Set loading appearance
var $loading = $('<div>').addClass('loading-overlay');
$detailView.prepend($loading);
args = args ? args : {};
@ -92,20 +94,23 @@
var $item = args.$item;
notification.desc = messages.notification(args.messageArgs);
notification._custom = args._custom;
notification._custom = $.extend(args._custom ? args._custom : {}, {
$detailView: $detailView
});
cloudStack.ui.notifications.add(
notification,
// Success
function(args) {
$loading.remove();
if (!$detailView.is(':visible')) return;
$loading.remove();
replaceListViewItem($detailView, args.data);
if (!noRefresh) {
updateTabContent(args.data);
}
replaceListViewItem($detailView, args.data);
},
{},
@ -131,7 +136,9 @@
response: {
success: function(args) {
args = args ? args : {};
notification._custom = args._custom;
notification._custom = $.extend(args._custom ? args._custom : {}, {
$detailView: $detailView
});
if (additional && additional.success) additional.success(args);