mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 11:52:28 +01:00
bug 13553: network page - Display "View IP adresses" option only for (1) Isolated networks with SourceNat (2) Shared networks with ELB/EIP/SecurityGroup.
This commit is contained in:
parent
881a46ff54
commit
e93af6e1f9
@ -284,9 +284,56 @@
|
||||
path: 'network.ipAddresses',
|
||||
label: 'IP addresses',
|
||||
preFilter: function(args) {
|
||||
if (args.context.networks[0].state == 'Destroyed') return false;
|
||||
|
||||
return true;
|
||||
if (args.context.networks[0].state == 'Destroyed')
|
||||
return false;
|
||||
|
||||
var services = args.context.networks[0].service;
|
||||
if(services == null)
|
||||
return false;
|
||||
|
||||
if(args.context.networks[0].type == "Isolated") {
|
||||
for(var i=0; i < services.length; i++) {
|
||||
var service = services[i];
|
||||
if(service.name == "SourceNat") {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(args.context.networks[0].type == "Shared") {
|
||||
var havingSecurityGroupService = false;
|
||||
var havingElasticIpCapability = false;
|
||||
var havingElasticLbCapability = false;
|
||||
|
||||
for(var i=0; i < services.length; i++) {
|
||||
var service = services[i];
|
||||
if(service.name == "SecurityGroup") {
|
||||
havingSecurityGroupService = true;
|
||||
}
|
||||
else if(service.name == "StaticNat") {
|
||||
$(service.capability).each(function(){
|
||||
if(this.name == "ElasticIp" && this.value == "true") {
|
||||
havingElasticIpCapability = true;
|
||||
return false; //break $.each() loop
|
||||
}
|
||||
});
|
||||
}
|
||||
else if(service.name == "Lb") {
|
||||
$(service.capability).each(function(){
|
||||
if(this.name == "ElasticLb" && this.value == "true") {
|
||||
havingElasticLbCapability = true;
|
||||
return false; //break $.each() loop
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if(havingSecurityGroupService == true && havingElasticIpCapability == true && havingElasticLbCapability == true)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user