CLOUDSTACK-4089: UI > zone wizard > hypervisor VMware > configure physical 
network > edit traffic type label > split "VMware Traffic Label" field into 3 
fields: "vSwitch Name", "VLAN ID", "vSwitch Type".


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

Branch: refs/heads/4.2
Commit: ae68c841f668768118bbff07f07060416fb16d48
Parents: 38d8a84
Author: Jessica Wang <[email protected]>
Authored: Mon Aug 26 14:24:22 2013 -0700
Committer: Jessica Wang <[email protected]>
Committed: Mon Aug 26 14:27:56 2013 -0700

----------------------------------------------------------------------
 ui/scripts/ui-custom/zoneWizard.js | 57 +++++++++++++++++++++++++++------
 ui/scripts/zoneWizard.js           | 29 ++++++++++++++++-
 2 files changed, 76 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ae68c841/ui/scripts/ui-custom/zoneWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui-custom/zoneWizard.js 
b/ui/scripts/ui-custom/zoneWizard.js
index 8af873e..b8f77a4 100644
--- a/ui/scripts/ui-custom/zoneWizard.js
+++ b/ui/scripts/ui-custom/zoneWizard.js
@@ -190,8 +190,7 @@
             var $configuredTrafficTypes = $trafficTypes.filter(function() {
                 var $trafficType = $(this);
 
-                return $trafficType.data('traffic-type-data') &&
-                    $trafficType.data('traffic-type-data').label.length >= 1;
+                return ($trafficType.data('traffic-type-data') != null);
             });
 
             if ($enabledPhysicalNetworks.size() > 1 &&
@@ -295,20 +294,60 @@
             var trafficData = $trafficType.data('traffic-type-data') ?
                 $trafficType.data('traffic-type-data') : {};
             var hypervisor = 
getData($trafficType.closest('.zone-wizard')).zone.hypervisor;
+            
+            var fields;
+            
+            if (hypervisor == 'VMware') {
+               fields = {
+                       vSwitchName: {
+                           label: 'vSwitch Name' ,
+                           defaultValue: trafficData.vSwitchName
+                       },
+                       vlanId: { 
+                               label: 'VLAN ID',
+                               defaultValue: trafficData.vlanId
+                       }                       
+                   };  
+               
+               if($trafficType.hasClass('guest') || 
$trafficType.hasClass('public')) {
+                       $.extend(fields, {
+                           vSwitchType: {
+                               label: 'vSwitch Type',
+                               select: function (args) {                       
                
+                                   args.response.success({
+                                       data: [{
+                                           id: 'nexusdvs',
+                                           description: 'Cisco Nexus 1000v 
Distributed Virtual Switch'
+                                       }, {
+                                           id: 'vmwaresvs',
+                                           description: 'VMware vNetwork 
Standard Virtual Switch'
+                                       }, {
+                                           id: 'vmwaredvs',
+                                           description: 'VMware vNetwork 
Distributed Virtual Switch'
+                                       }],
+                                       defaultValue: trafficData.vSwitchType
+                                   });
+                               }
+                           }
+                       });   
+               }               
+            } else {    
+                   fields = {
+                       label: {
+                           label: hypervisor + ' ' + _l('label.traffic.label'),
+                           defaultValue: trafficData.label
+                       }
+                   };
+            }
 
             cloudStack.dialog.createForm({
                 form: {
                     title: _l('label.edit.traffic.type'),
                     desc: _l('message.edit.traffic.type'),
-                    fields: {
-                        label: {
-                            label: hypervisor + ' ' + 
_l('label.traffic.label'),
-                            defaultValue: trafficData.label
-                        }
-                    }
+                    fields: fields
                 },
 
-                after: function(args) {
+                after: function(args) {               
                     $trafficType.data('traffic-type-data', args.data);
                 }
             });

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ae68c841/ui/scripts/zoneWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/zoneWizard.js b/ui/scripts/zoneWizard.js
index 02a68db..5811909 100755
--- a/ui/scripts/zoneWizard.js
+++ b/ui/scripts/zoneWizard.js
@@ -34,7 +34,34 @@
         physicalNetworkID = zoneType == 'Advanced' ? physicalNetworkID : 0;
         var physicalNetwork = data.physicalNetworks ? 
data.physicalNetworks[physicalNetworkID] : null;
         var trafficConfig = physicalNetwork ? 
physicalNetwork.trafficTypeConfiguration[trafficTypeID] : null;
-        var trafficLabel = trafficConfig ? trafficConfig.label : null;
+                
+        var trafficLabel;       
+        if (trafficConfig != null) {
+               if ('label' in trafficConfig) {
+                       trafficLabel = trafficConfig.label;
+               }
+               else {
+                       trafficLabel = '';
+                       
+                       if ('vSwitchName' in trafficConfig) {
+                               trafficLabel += trafficConfig.vSwitchName;
+                       }
+                       if ('vlanId' in trafficConfig) {
+                               if (trafficLabel.length > 0)
+                                       trafficLabel += ',';
+                               trafficLabel += trafficConfig.vlanId;
+                       }
+                       if ('vSwitchType' in trafficConfig) {
+                               if (trafficLabel.length > 0)
+                                       trafficLabel += ',';
+                               trafficLabel += trafficConfig.vSwitchType;
+                       }
+                       
+                       if (trafficLabel.length == 0) //trafficLabel == ''
+                               trafficLabel = null;
+               }
+        }
+        
         var hypervisorAttr, trafficLabelStr;
 
         switch (hypervisor) {

Reply via email to