CLOUDSTACK-1065: cloudstack UI - AWS Style Regions - remove region action - removing the region that you are currently in is not allowed.

This commit is contained in:
Jessica Wang 2013-03-20 15:19:36 -07:00
parent ae7e5b025e
commit 75a6e009b9
2 changed files with 11 additions and 3 deletions

View File

@ -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];

View File

@ -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');
}