You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by je...@apache.org on 2014/06/11 20:17:23 UTC

git commit: updated refs/heads/4.4-forward to 81857d0

Repository: cloudstack
Updated Branches:
  refs/heads/4.4-forward 63ff5a7cb -> 81857d057


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.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/81857d05
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/81857d05
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/81857d05

Branch: refs/heads/4.4-forward
Commit: 81857d0577bbd9a7febef74a224e06516fadc39f
Parents: 63ff5a7
Author: Jessica Wang <je...@apache.org>
Authored: Wed Jun 11 10:50:14 2014 -0700
Committer: Jessica Wang <je...@apache.org>
Committed: Wed Jun 11 11:17:07 2014 -0700

----------------------------------------------------------------------
 ui/scripts/configuration.js | 39 ++++++++++++++++++++++-----------------
 1 file changed, 22 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/81857d05/ui/scripts/configuration.js
----------------------------------------------------------------------
diff --git a/ui/scripts/configuration.js b/ui/scripts/configuration.js
index 6a4aa42..f56f4e2 100644
--- a/ui/scripts/configuration.js
+++ b/ui/scripts/configuration.js
@@ -2324,9 +2324,9 @@
                                         }
 
                                         if (args.$form.find('.form-item[rel=\"service.Firewall.isEnabled\"] input[type=checkbox]').is(':checked') == true) {
-                                            args.$form.find('.form-item[rel=\"egresspolicy\"]').css('display', 'inline-block');
+                                            args.$form.find('.form-item[rel=\"egressdefaultpolicy\"]').css('display', 'inline-block');
                                         } else {
-                                            args.$form.find('.form-item[rel=\"egresspolicy\"]').css('display', 'none');
+                                            args.$form.find('.form-item[rel=\"egressdefaultpolicy\"]').css('display', 'none');
                                         }
 
                                         //show LB Isolation dropdown only when (1)LB Service is checked (2)Service Provider is Netscaler OR F5
@@ -2749,6 +2749,7 @@
                                     conservemode: {
                                         label: 'label.conserve.mode',
                                         isBoolean: true,
+                                        isChecked: true,
                                         docID: 'helpNetworkOfferingConserveMode'
                                     },
 
@@ -2773,7 +2774,7 @@
                                         }
                                     },
 
-                                    egresspolicy: {
+                                    egressdefaultpolicy: {
                                         label: 'label.default.egress.policy',
                                         isHidden: true,
                                         select: function(args) {
@@ -2848,8 +2849,8 @@
                                             inputData['servicecapabilitylist[' + serviceCapabilityIndex + '].capabilityvalue'] = 'internal';
                                             serviceCapabilityIndex++;
                                         } 
-                                    } 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) 
-                                        if (!(key ==  "lbType"  || (key == "availability" && value == "Optional") || key == "state" || key == "status" || key == "allocationstate")) {
+                                    } 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) 
+                                        if (!(key ==  "lbType"  || (key == "availability" && value == "Optional") || key == "state" || key == "status" || key == "allocationstate" || key == "useVpc" )) {
                                             inputData[key] = value;
                                         }                                        
                                     }
@@ -2898,28 +2899,28 @@
 
                                 if (inputData['guestIpType'] == "Shared") { //specifyVlan checkbox is disabled, so inputData won't include specifyVlan
                                     inputData['specifyVlan'] = true; //hardcode inputData['specifyVlan']
-                                    inputData['specifyIpRanges'] = true;
-                                    inputData['isPersistent'] = false;
+                                    inputData['specifyIpRanges'] = true;                                    
+                                    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)                                          
                                 } else if (inputData['guestIpType'] == "Isolated") { //specifyVlan checkbox is shown
-                                    inputData['specifyIpRanges'] = false;
-
+                                    //inputData['specifyIpRanges'] = false;
+                                    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)                                          
+                                          
                                     if (inputData['specifyVlan'] == 'on') { //specifyVlan checkbox is checked
                                         inputData['specifyVlan'] = true;
-                                    } else { //specifyVlan checkbox is unchecked
-                                        inputData['specifyVlan'] = false;
-
+                                    } else { //specifyVlan checkbox is unchecked                                        
+                                        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)                                        
                                     }
 
                                     if (inputData['isPersistent'] == 'on') { //It is a persistent network
                                         inputData['isPersistent'] = true;
                                     } else { //Isolated Network with Non-persistent network
-                                        inputData['isPersistent'] = false;
+                                        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)                                          
                                     }
                                 }
 
 
                                 if (inputData['conservemode'] == 'on') {
-                                    inputData['conservemode'] = true;
+                                    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)
                                 } else {
                                     inputData['conservemode'] = false;
                                 }
@@ -2932,10 +2933,14 @@
                                     serviceProviderIndex++;
                                 });
                                 
-                                if (args.$form.find('.form-item[rel=egresspolicy]').is(':visible')) {
-                                    inputData['egressdefaultpolicy'] = formData.egresspolicy === 'ALLOW' ? true : false;
+                                if (args.$form.find('.form-item[rel=egressdefaultpolicy]').is(':visible')) {
+                                    if (formData.egressdefaultpolicy === 'ALLOW') {
+                                        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)
+                                    } else {
+                                        inputData['egressdefaultpolicy'] = false;
+                                    }
                                 } else {
-                                    delete inputData.egresspolicy;
+                                    delete inputData.egressdefaultpolicy;
                                 }
 
                                 if (args.$form.find('.form-item[rel=serviceofferingid]').css("display") == "none")