Skip to content

Commit fa3bda1

Browse files
author
Jessica Wang
committed
CLOUDSTACK-6889: UI - create network offering - to reduce API call size, not pass any parameter whose value entered on UI happens to be the same as its default value at server-side.
1 parent 9855a84 commit fa3bda1

1 file changed

Lines changed: 19 additions & 14 deletions

File tree

ui/scripts/configuration.js

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2402,9 +2402,9 @@
24022402
}
24032403

24042404
if (args.$form.find('.form-item[rel=\"service.Firewall.isEnabled\"] input[type=checkbox]').is(':checked') == true) {
2405-
args.$form.find('.form-item[rel=\"egresspolicy\"]').css('display', 'inline-block');
2405+
args.$form.find('.form-item[rel=\"egressdefaultpolicy\"]').css('display', 'inline-block');
24062406
} else {
2407-
args.$form.find('.form-item[rel=\"egresspolicy\"]').css('display', 'none');
2407+
args.$form.find('.form-item[rel=\"egressdefaultpolicy\"]').css('display', 'none');
24082408
}
24092409

24102410
//show LB Isolation dropdown only when (1)LB Service is checked (2)Service Provider is Netscaler OR F5
@@ -2827,6 +2827,7 @@
28272827
conservemode: {
28282828
label: 'label.conserve.mode',
28292829
isBoolean: true,
2830+
isChecked: true,
28302831
docID: 'helpNetworkOfferingConserveMode'
28312832
},
28322833

@@ -2851,7 +2852,7 @@
28512852
}
28522853
},
28532854

2854-
egresspolicy: {
2855+
egressdefaultpolicy: {
28552856
label: 'label.default.egress.policy',
28562857
isHidden: true,
28572858
select: function(args) {
@@ -2926,8 +2927,8 @@
29262927
inputData['servicecapabilitylist[' + serviceCapabilityIndex + '].capabilityvalue'] = 'internal';
29272928
serviceCapabilityIndex++;
29282929
}
2929-
} else if (value != '') { // normal data (serviceData.length ==1), e.g. "name", "displayText", "networkRate", "guestIpType", "lbType" (unwanted), "availability" (unwated when value is "Optional"), "egresspolicy", "state" (unwanted), "status" (unwanted), "allocationstate" (unwanted)
2930-
if (!(key == "lbType" || (key == "availability" && value == "Optional") || key == "state" || key == "status" || key == "allocationstate")) {
2930+
} else if (value != '') { // normal data (serviceData.length ==1), e.g. "name", "displayText", "networkRate", "guestIpType", "lbType" (unwanted), "availability" (unwated when value is "Optional"), "egressdefaultpolicy", "state" (unwanted), "status" (unwanted), "allocationstate" (unwanted)
2931+
if (!(key == "lbType" || (key == "availability" && value == "Optional") || key == "state" || key == "status" || key == "allocationstate" || key == "useVpc" )) {
29312932
inputData[key] = value;
29322933
}
29332934
}
@@ -2977,27 +2978,27 @@
29772978
if (inputData['guestIpType'] == "Shared") { //specifyVlan checkbox is disabled, so inputData won't include specifyVlan
29782979
inputData['specifyVlan'] = true; //hardcode inputData['specifyVlan']
29792980
inputData['specifyIpRanges'] = true;
2980-
inputData['isPersistent'] = false;
2981+
delete inputData.isPersistent; //if Persistent checkbox is unchecked, do not pass isPersistent parameter to API call since we need to keep API call's size as small as possible (p.s. isPersistent is defaulted as false at server-side)
29812982
} else if (inputData['guestIpType'] == "Isolated") { //specifyVlan checkbox is shown
2982-
inputData['specifyIpRanges'] = false;
2983+
//inputData['specifyIpRanges'] = false;
2984+
delete inputData.specifyIpRanges; //if specifyIpRanges should be false, do not pass specifyIpRanges parameter to API call since we need to keep API call's size as small as possible (p.s. specifyIpRanges is defaulted as false at server-side)
29832985

29842986
if (inputData['specifyVlan'] == 'on') { //specifyVlan checkbox is checked
29852987
inputData['specifyVlan'] = true;
29862988
} else { //specifyVlan checkbox is unchecked
2987-
inputData['specifyVlan'] = false;
2988-
2989+
delete inputData.specifyVlan; //if specifyVlan checkbox is unchecked, do not pass specifyVlan parameter to API call since we need to keep API call's size as small as possible (p.s. specifyVlan is defaulted as false at server-side)
29892990
}
29902991

29912992
if (inputData['isPersistent'] == 'on') { //It is a persistent network
29922993
inputData['isPersistent'] = true;
29932994
} else { //Isolated Network with Non-persistent network
2994-
inputData['isPersistent'] = false;
2995+
delete inputData.isPersistent; //if Persistent checkbox is unchecked, do not pass isPersistent parameter to API call since we need to keep API call's size as small as possible (p.s. isPersistent is defaulted as false at server-side)
29952996
}
29962997
}
29972998

29982999

29993000
if (inputData['conservemode'] == 'on') {
3000-
inputData['conservemode'] = true;
3001+
delete inputData.conservemode; //if ConserveMode checkbox is checked, do not pass conservemode parameter to API call since we need to keep API call's size as small as possible (p.s. conservemode is defaulted as true at server-side)
30013002
} else {
30023003
inputData['conservemode'] = false;
30033004
}
@@ -3010,10 +3011,14 @@
30103011
serviceProviderIndex++;
30113012
});
30123013

3013-
if (args.$form.find('.form-item[rel=egresspolicy]').is(':visible')) {
3014-
inputData['egressdefaultpolicy'] = formData.egresspolicy === 'ALLOW' ? true : false;
3014+
if (args.$form.find('.form-item[rel=egressdefaultpolicy]').is(':visible')) {
3015+
if (formData.egressdefaultpolicy === 'ALLOW') {
3016+
delete inputData.egressdefaultpolicy; //do not pass egressdefaultpolicy to API call since we need to keep API call's size as small as possible (p.s. egressdefaultpolicy is defaulted as true at server-side)
3017+
} else {
3018+
inputData['egressdefaultpolicy'] = false;
3019+
}
30153020
} else {
3016-
delete inputData.egresspolicy;
3021+
delete inputData.egressdefaultpolicy;
30173022
}
30183023

30193024
if (args.$form.find('.form-item[rel=serviceofferingid]').css("display") == "none")

0 commit comments

Comments
 (0)