Skip to content

Commit 4bab97b

Browse files
committed
Hide acquire new IP button if in advanced SG zone
1 parent 2514b92 commit 4bab97b

1 file changed

Lines changed: 23 additions & 18 deletions

File tree

‎ui/scripts/network.js‎

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,49 +1440,54 @@
14401440
addRow: 'true',
14411441
preFilter: function(args) {
14421442
var zoneObj;
1443-
var dataObj = {};
1444-
if('vpc' in args.context) { //from VPC section
1445-
$.extend(dataObj, {
1446-
id: args.context.vpc[0].zoneid
1447-
});
1448-
}
1449-
else if('networks' in args.context) { //from Guest Network section
1450-
$.extend(dataObj, {
1451-
id: args.context.networks[0].zoneid
1452-
});
1453-
}
1443+
var dataObj = {};
1444+
1445+
if ('vpc' in args.context) { //from VPC section
1446+
$.extend(dataObj, {
1447+
id: args.context.vpc[0].zoneid
1448+
});
1449+
} else if ('networks' in args.context) { //from Guest Network section
1450+
$.extend(dataObj, {
1451+
id: args.context.networks[0].zoneid
1452+
});
1453+
}
14541454

14551455
$.ajax({
14561456
url: createURL('listZones'),
14571457
data: dataObj,
1458+
// id: args.context.networks[0].zoneid
1459+
// },
14581460
async: false,
14591461
success: function(json) {
14601462
zoneObj = json.listzonesresponse.zone[0];
14611463
}
14621464
});
1465+
1466+
if (zoneObj.networktype == 'Advanced' && zoneObj.securitygroupsenabled) {
1467+
return false;
1468+
}
14631469

1464-
if(zoneObj.networktype == 'Basic') {
1470+
if (zoneObj.networktype == 'Basic') {
14651471
var havingEIP = false, havingELB = false;
14661472
$.ajax({
14671473
url: createURL('listNetworkOfferings'),
14681474
data: {
14691475
id: args.context.networks[0].networkofferingid
14701476
},
14711477
async: false,
1472-
success: function(json) {
1478+
success: function(json) {
14731479
$(json.listnetworkofferingsresponse.networkoffering[0].service).each(function(){
14741480
var thisService = this;
1475-
if(thisService.name == "StaticNat") {
1481+
if (thisService.name == "StaticNat") {
14761482
$(thisService.capability).each(function(){
1477-
if(this.name == "ElasticIp" && this.value == "true") {
1483+
if (this.name == "ElasticIp" && this.value == "true") {
14781484
havingEIP = true;
14791485
return false; //break $.each() loop
14801486
}
14811487
});
1482-
}
1483-
else if(thisService.name == "Lb") {
1488+
} else if (thisService.name == "Lb") {
14841489
$(thisService.capability).each(function(){
1485-
if(this.name == "ElasticLb" && this.value == "true") {
1490+
if (this.name == "ElasticLb" && this.value == "true") {
14861491
havingELB = true;
14871492
return false; //break $.each() loop
14881493
}

0 commit comments

Comments
 (0)