Skip to content

Commit ec40aff

Browse files
author
Jessica Wang
committed
CLOUDSTACK-459: cloudstack UI - create network offering - When capability ElasticIp=true is passed to API, if capability associatePublicIP=true/false is not passed to API, cloudStack API will assume associatePublicIP=true. So, UI has to explicitly pass associatePublicIP=false to API if its checkbox is unchecked.
1 parent 05d3f86 commit ec40aff

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

‎ui/scripts/configuration.js‎

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1720,7 +1720,28 @@
17201720
inputData[key] = value;
17211721
}
17221722
});
1723-
1723+
1724+
for(var key1 in inputData) {
1725+
/* When capability ElasticIp=true is passed to API, if capability associatePublicIP is not passed to API, cloudStack API will assume associatePublicIP=true.
1726+
So, UI has to explicitly pass associatePublicIP=false to API if its checkbox is unchecked. */
1727+
if(inputData[key1] == 'ElasticIp') { //ElasticIp checkbox is checked
1728+
var associatePublicIPExists = false;
1729+
for(var key2 in inputData) {
1730+
if(inputData[key2] == 'associatePublicIP') {
1731+
associatePublicIPExists = true;
1732+
break; //break key2 for loop
1733+
}
1734+
}
1735+
if(associatePublicIPExists == false) { //but associatePublicIP checkbox is unchecked
1736+
//UI explicitly passes associatePublicIP=false to API
1737+
inputData['servicecapabilitylist[' + serviceCapabilityIndex + '].service'] = 'StaticNat';
1738+
inputData['servicecapabilitylist[' + serviceCapabilityIndex + '].capabilitytype'] = 'associatePublicIP';
1739+
inputData['servicecapabilitylist[' + serviceCapabilityIndex + '].capabilityvalue'] = false; //associatePublicIP checkbox is unchecked
1740+
}
1741+
break; //break key1 for loop
1742+
}
1743+
}
1744+
17241745
// Make supported services list
17251746
inputData['supportedServices'] = $.map(serviceProviderMap, function(value, key) {
17261747
return key;

0 commit comments

Comments
 (0)