Updated Branches: refs/heads/master ae7e5b025 -> 75a6e009b
CLOUDSTACK-1065: cloudstack UI - AWS Style Regions - remove region action - removing the region that you are currently in is not allowed. Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/75a6e009 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/75a6e009 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/75a6e009 Branch: refs/heads/master Commit: 75a6e009b9d2b69c534a4a8e0d0ea1a63c10c3c5 Parents: ae7e5b0 Author: Jessica Wang <[email protected]> Authored: Wed Mar 20 15:19:36 2013 -0700 Committer: Jessica Wang <[email protected]> Committed: Wed Mar 20 15:19:36 2013 -0700 ---------------------------------------------------------------------- ui/scripts/regions.js | 12 ++++++++++-- ui/scripts/ui-custom/regions.js | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/75a6e009/ui/scripts/regions.js ---------------------------------------------------------------------- diff --git a/ui/scripts/regions.js b/ui/scripts/regions.js index 79557ad..72940e1 100644 --- a/ui/scripts/regions.js +++ b/ui/scripts/regions.js @@ -70,7 +70,7 @@ success: function(json) { var item = json.addregionresponse.region; args.response.success({data: item}); - //$(window).trigger('cloudStack.refreshRegions'); + $(window).trigger('cloudStack.refreshRegions'); }, error: function(json) { args.response.error(parseXMLHttpResponse(json)); @@ -123,7 +123,15 @@ messages: { notification: function() { return 'label.remove.region'; }, confirm: function() { return 'message.remove.region'; } - }, + }, + preAction: function(args) { + var region = args.context.regions[0]; + if(region.endpoint == document.location.href) { + cloudStack.dialog.notice({ message: _l('You can not remove the region that you are currently in.') }); + return false; + } + return true; + }, action: function(args) { var region = args.context.regions[0]; http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/75a6e009/ui/scripts/ui-custom/regions.js ---------------------------------------------------------------------- diff --git a/ui/scripts/ui-custom/regions.js b/ui/scripts/ui-custom/regions.js index 354ecee..474e498 100644 --- a/ui/scripts/ui-custom/regions.js +++ b/ui/scripts/ui-custom/regions.js @@ -37,7 +37,7 @@ $li.data('region-data', region); - if(document.location.href == region.endpoint) { + if(region.endpoint == document.location.href) { currentRegion = region; $li.addClass('active'); }
