CLOUDSTACK-537: cloudstack UI - Infrastructure menu - create network dialog - Advanced sg-enabled zone - (1) account-specific network doesn't work at backend. Therefore, remove "account" option from scope dropdown. (2) zone-wide network: list only sg network offerings.

This commit is contained in:
Jessica Wang 2013-02-07 13:17:45 -08:00
parent 5ce1f3b128
commit a02c66594f
1 changed files with 19 additions and 27 deletions

View File

@ -1144,8 +1144,7 @@
docID: 'helpGuestNetworkZoneScope',
select: function(args) {
var array1 = [];
if(args.context.zones[0].networktype == "Advanced" && args.context.zones[0].securitygroupsenabled == true) {
array1.push({id: 'account-specific', description: 'Account'});
if(args.context.zones[0].networktype == "Advanced" && args.context.zones[0].securitygroupsenabled == true) {
array1.push({id: 'zone-wide', description: 'All'});
}
else {
@ -1312,38 +1311,31 @@
}
var networkOfferingArray = [];
$.ajax({
url: createURL(apiCmd + array1.join("")),
dataType: "json",
async: false,
success: function(json) {
success: function(json) {
networkOfferingObjs = json.listnetworkofferingsresponse.networkoffering;
if (networkOfferingObjs != null && networkOfferingObjs.length > 0) {
for (var i = 0; i < networkOfferingObjs.length; i++) {
if(args.scope=="account-specific" && args.context.zones[0].securitygroupsenabled == true) { //BUG - CLOUDSTACK-1063
var serviceObjArray = networkOfferingObjs[i].name;
if(serviceObjArray == "DefaultSharedNetworkOfferingWithSGService"){
continue;
}
}
//comment out the following 12 lines because of CS-16718
/*
if(args.scope == "account-specific" || args.scope == "project-specific") { //if args.scope == "account-specific" or "project-specific", exclude Isolated network offerings with SourceNat service (bug 12869)
var includingSourceNat = false;
var serviceObjArray = networkOfferingObjs[i].service;
for(var k = 0; k < serviceObjArray.length; k++) {
if(serviceObjArray[k].name == "SourceNat") {
includingSourceNat = true;
break;
}
}
if(includingSourceNat == true)
continue; //skip to next network offering
for (var i = 0; i < networkOfferingObjs.length; i++) {
//for zone-wide network in Advanced SG-enabled zone, list only SG network offerings
if(args.context.zones[0].networktype == 'Advanced' && args.context.zones[0].securitygroupsenabled == true) {
if(args.scope == "zone-wide") {
var includingSecurityGroup = false;
var serviceObjArray = networkOfferingObjs[i].service;
for(var k = 0; k < serviceObjArray.length; k++) {
if(serviceObjArray[k].name == "SecurityGroup") {
includingSecurityGroup = true;
break;
}
}
if(includingSecurityGroup == false)
continue; //skip to next network offering
}
}
*/
networkOfferingArray.push({id: networkOfferingObjs[i].id, description: networkOfferingObjs[i].displaytext});
}
}