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.
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/a02c6659 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/a02c6659 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/a02c6659 Branch: refs/heads/ui-plugins Commit: a02c66594f3209409737a7c364ce65884a0f1f83 Parents: 5ce1f3b Author: Jessica Wang <[email protected]> Authored: Thu Feb 7 13:17:45 2013 -0800 Committer: Jessica Wang <[email protected]> Committed: Thu Feb 7 13:17:45 2013 -0800 ---------------------------------------------------------------------- ui/scripts/system.js | 46 ++++++++++++++++++-------------------------- 1 files changed, 19 insertions(+), 27 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a02c6659/ui/scripts/system.js ---------------------------------------------------------------------- diff --git a/ui/scripts/system.js b/ui/scripts/system.js index 2ce7672..cb09a85 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -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}); } }
