bug 12542

Add action pre-filter to add network action -- if guest network is
present and zone is basic, pop up a notice message and prevent dialog
from appearing

status 12542: resolved fixed
This commit is contained in:
Brian Federle 2011-12-14 11:31:36 -08:00
parent cf51252f71
commit e230341a05
1 changed files with 31 additions and 0 deletions

View File

@ -853,6 +853,37 @@
});
},
preAction: function(args) {
var zone = $('.detail-view:last').data('view-args').context.zones[0];
var networksPresent = false;
// Only 1 guest network is allowed per basic zone,
// so don't show the dialog in this case
$.ajax({
url: createURL('listNetworks'),
data: {
trafficType: 'guest',
zoneId: zone.id
},
async: false,
success: function(json) {
if (json.listnetworksresponse.network) {
networksPresent = true;
}
}
});
if (zone.networktype == 'Basic' && networksPresent) {
cloudStack.dialog.notice({
message: 'Sorry, you can only have one guest network for a basic zone.'
});
return false;
}
return true;
},
notification: {
poll: function(args) {
args.complete();