You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bf...@apache.org on 2012/11/15 21:18:16 UTC

git commit: Instance wizard UI: Support conditional hide/show of add network box

Updated Branches:
  refs/heads/master 83229aa46 -> 27fcb788e


Instance wizard UI: Support conditional hide/show of add network box

Adds new function 'showAddNetwork' to instance wizard configuration,
which conditionally hides the 'add network form' on the select network
step. If it returns true, then show the box, otherwise false hides it.


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

Branch: refs/heads/master
Commit: 27fcb788e9e891a3eb4c13e982f2282a348dc04e
Parents: 83229aa
Author: Brian Federle <br...@citrix.com>
Authored: Thu Nov 15 12:14:33 2012 -0800
Committer: Brian Federle <br...@citrix.com>
Committed: Thu Nov 15 12:16:42 2012 -0800

----------------------------------------------------------------------
 ui/scripts/instanceWizard.js           |    6 ++++++
 ui/scripts/ui-custom/instanceWizard.js |   19 +++++++++++++++++++
 2 files changed, 25 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/27fcb788/ui/scripts/instanceWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/instanceWizard.js b/ui/scripts/instanceWizard.js
index 1d37f78..b29ceaa 100644
--- a/ui/scripts/instanceWizard.js
+++ b/ui/scripts/instanceWizard.js
@@ -25,6 +25,12 @@
       return g_capabilities.customdiskofferingmaxsize;
     },
 
+    // Determines whether 'add new network' box is shown.
+    // -- return true to show, false to hide
+    showAddNetwork: function(args) {
+      return true;
+    },
+
     // Called in networks list, when VPC drop-down is changed
     // -- if vpcID given, return true if in network specified by vpcID
     // -- if vpcID == -1, return true if network is not associated with a VPC

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/27fcb788/ui/scripts/ui-custom/instanceWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui-custom/instanceWizard.js b/ui/scripts/ui-custom/instanceWizard.js
index a591d17..d2724a5 100644
--- a/ui/scripts/ui-custom/instanceWizard.js
+++ b/ui/scripts/ui-custom/instanceWizard.js
@@ -464,6 +464,16 @@
           },
 
           'network': function($step, formData) {
+            var showAddNetwork = true;
+
+            var checkShowAddNetwork = function($newNetwork) {
+              if (!showAddNetwork) {
+                $newNetwork.hide();
+              } else {
+                $newNetwork.show();
+              }
+            };
+
             var originalValues = function(formData) {
               // Default networks
               $step.find('input[type=radio]').filter(function() {
@@ -523,6 +533,13 @@
             // Show relevant conditional sub-step if present
             $step.find('.wizard-step-conditional').hide();
 
+            if ($.isFunction(args.showAddNetwork)) {
+              showAddNetwork = args.showAddNetwork({
+                data: formData,
+                context: context
+              });
+            }
+
             // Filter network list by VPC ID
             var filterNetworkList = function(vpcID) {
               var $selects = $step.find('.my-networks .select-container .select');
@@ -546,6 +563,7 @@
               } else {
                 $step.find('.my-networks .select-container').removeClass('single-select');
                 $addNetworkForm.show();
+                checkShowAddNetwork($addNetworkForm);
               }
               
               $selects.find('input[type=checkbox]').attr('checked', false);
@@ -648,6 +666,7 @@
                   );
 
                   originalValues(formData);
+                  checkShowAddNetwork($newNetwork);
                 }
               }
             };