From 4efd42cac1247a70d32a7941b567356010e0ccfd Mon Sep 17 00:00:00 2001 From: bfederle Date: Wed, 25 Jan 2012 13:58:25 -0800 Subject: [PATCH] Network section: IP address action updates Prompt user to close details/refresh list view after these actions are performed: -Enable static NAT -Disable static NAT Always do a full refresh after releasing an IP. --- ui/scripts/network.js | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/ui/scripts/network.js b/ui/scripts/network.js index 8fd3df45cda..f5093addf74 100644 --- a/ui/scripts/network.js +++ b/ui/scripts/network.js @@ -1,4 +1,18 @@ (function(cloudStack, $, testData) { + var ipChangeNotice = function() { + cloudStack.dialog.confirm({ + message: 'Your IP addresses may have changed; would you like to refresh the listing? Note that in this case the details pane will close.', + action: function() { + $('#browser .container').cloudBrowser('selectPanel', { + panel: $('#browser .panel:last').prev(), + complete: function() { + $(window).trigger('cloudStack.fullRefresh'); + } + }); + } + }); + }; + var actionFilters = { ipAddress: function(args) { var allowedActions = args.context.actions; @@ -1088,12 +1102,10 @@ args.complete({ data: { isstaticnat: true - } + }, }); - setTimeout(function() { - $(window).trigger('cloudStack.fullRefresh'); - }, 500); + ipChangeNotice(); } } }, @@ -1122,7 +1134,7 @@ return ['enableStaticNAT']; }; }, - fullRefreshAfterComplete: true + onComplete: ipChangeNotice } }); }, @@ -1169,7 +1181,9 @@ state: 'Released' }; }, - fullRefreshAfterComplete: true + onComplete: function() { + $(window).trigger('cloudStack.fullRefresh'); + } } }); },