You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ts...@apache.org on 2013/04/09 15:20:51 UTC

[14/50] [abbrv] git commit: updated refs/heads/marvin_refactor to 2a99064

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/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7c02636e
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7c02636e
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7c02636e

Branch: refs/heads/marvin_refactor
Commit: 7c02636e5e0b708f8f946932dcea88e69ae5d06b
Parents: 4d3a999
Author: Jessica Wang <je...@citrix.com>
Authored: Wed Mar 20 15:19:36 2013 -0700
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Sun Mar 31 22:02:01 2013 +0530

----------------------------------------------------------------------
 ui/scripts/regions.js           |   10 +++++++++-
 ui/scripts/ui-custom/regions.js |    2 +-
 2 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c02636e/ui/scripts/regions.js
----------------------------------------------------------------------
diff --git a/ui/scripts/regions.js b/ui/scripts/regions.js
index 6e87c7f..edc96cb 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));
@@ -124,6 +124,14 @@
               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/cloudstack/blob/7c02636e/ui/scripts/ui-custom/regions.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui-custom/regions.js b/ui/scripts/ui-custom/regions.js
index 611edda..819dfd0 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');
 							}