@@ -10088,21 +10088,21 @@
1008810088 preFilter: function(args) {
1008910089 var $form = args.$form;
1009010090 $form.click(function() {
10091- var $vsmFields = $form.find('.form-item').filter(function() {
10092- var vsmFields = [
10091+ var $nexusDvsOptFields = $form.find('.form-item').filter(function() {
10092+ var nexusDvsOptFields = [
1009310093 'vsmipaddress',
1009410094 'vsmusername',
1009510095 'vsmpassword'
1009610096 ];
10097- return $.inArray($(this).attr('rel'), vsmFields ) > -1;
10097+ return $.inArray($(this).attr('rel'), nexusDvsOptFields ) > -1;
1009810098 });
10099- var $vsmReqFields = $form.find('.form-item').filter(function() {
10100- var vsmReqFields = [
10099+ var $nexusDvsReqFields = $form.find('.form-item').filter(function() {
10100+ var nexusDvsReqFields = [
1010110101 'vsmipaddress_req',
1010210102 'vsmusername_req',
1010310103 'vsmpassword_req'
1010410104 ];
10105- return $.inArray($(this).attr('rel'), vsmReqFields ) > -1;
10105+ return $.inArray($(this).attr('rel'), nexusDvsReqFields ) > -1;
1010610106 });
1010710107
1010810108 if ($form.find('.form-item[rel=hypervisor] select').val() == 'VMware' ) {
1011610116 var $overrideGuestTraffic = $form.find('.form-item[rel=overrideguesttraffic] input[type=checkbox]');
1011710117 var $vSwitchGuestType = $form.find('.form-item[rel=vSwitchGuestType] select');
1011810118
10119- //***** 'vmware.use.dvswitch' : whether to show override traffic checkbox (begin) *****
10120- var dvSwitchEnabled = false;
10119+
10120+ var useDvs = false;
1012110121 $.ajax({
1012210122 url: createURL('listConfigurations'),
1012310123 data: {
@@ -10126,16 +10126,15 @@
1012610126 async: false,
1012710127 success: function(json) {
1012810128 if (json.listconfigurationsresponse.configuration[0].value == 'true') {
10129- dvSwitchEnabled = true;
10129+ useDvs = true;
1013010130 }
1013110131 }
1013210132 });
10133- if (dvSwitchEnabled == true) {
10133+ if (useDvs == true) { //If using Distributed vswitch, there is OverrideTraffic option.
1013410134 $form.find('.form-item[rel=overridepublictraffic]').css('display', 'inline-block');
1013510135 $form.find('.form-item[rel=overrideguesttraffic]').css('display', 'inline-block');
10136-
10137- //'vmware.use.nexus.vswitch': whether to show VSM fields (begin)
10138- var vSwitchEnabled = false;
10136+
10137+ var useNexusDvs = false;
1013910138 $.ajax({
1014010139 url: createURL('listConfigurations'),
1014110140 data: {
@@ -10144,27 +10143,26 @@
1014410143 async: false,
1014510144 success: function(json) {
1014610145 if (json.listconfigurationsresponse.configuration[0].value == 'true') {
10147- vSwitchEnabled = true;
10146+ useNexusDvs = true;
1014810147 }
1014910148 }
1015010149 });
10151- if (vSwitchEnabled == true) {
10150+ if (useNexusDvs == true) { //If using Nexus Distributed vswitch, show Nexus Distributed vswitch fields (either required ones or optional ones).
1015210151 if (($overridePublicTraffic.is(':checked') && $vSwitchPublicType.val() == 'nexusdvs') ||
1015310152 ($overrideGuestTraffic.is(':checked') && $vSwitchGuestType.val() == 'nexusdvs' )) {
10154- $vsmReqFields .css('display', 'inline-block');
10155- $vsmFields .hide();
10153+ $nexusDvsReqFields .css('display', 'inline-block');
10154+ $nexusDvsOptFields .hide();
1015610155 } else {
10157- $vsmFields .css('display', 'inline-block');
10158- $vsmReqFields .hide();
10156+ $nexusDvsOptFields .css('display', 'inline-block');
10157+ $nexusDvsReqFields .hide();
1015910158 }
1016010159
10161- } else { //vSwitchEnabled == false
10162- $vsmFields.hide();
10163- $vsmReqFields.hide();
10164- }
10165- //***** 'vmware.use.dvswitch' : whether to show override traffic checkbox (end) *****
10160+ } else { //If not using Nexus Distributed vswitch, hide Nexus Distributed vswitch fields.
10161+ $nexusDvsOptFields.hide();
10162+ $nexusDvsReqFields.hide();
10163+ }
1016610164
10167- } else { //dvSwitchEnabled == false
10165+ } else { //useDvs == false
1016810166 $form.find('.form-item[rel=overridepublictraffic]').css('display', 'none');
1016910167 $form.find('.form-item[rel=vSwitchPublicType]').css('display', 'none');
1017010168 $form.find('.form-item[rel=vSwitchPublicName]').css('display', 'none');
@@ -10173,10 +10171,10 @@
1017310171 $form.find('.form-item[rel=vSwitchGuestType]').css('display', 'none');
1017410172 $form.find('.form-item[rel=vSwitchGuestName]').css('display', 'none');
1017510173
10176- $vsmFields .hide();
10177- $vsmReqFields .hide();
10174+ $nexusDvsOptFields .hide();
10175+ $nexusDvsReqFields .hide();
1017810176 }
10179- //***** 'vmware.use.dvswitch' (end) *****
10177+
1018010178
1018110179 } else { //XenServer, KVM, etc (non-VMware)
1018210180 $form.find('.form-item[rel=vCenterHost]').css('display', 'none');
1018710185
1018810186 $form.find('.form-item[rel=overridepublictraffic]').css('display', 'none');
1018910187 $form.find('.form-item[rel=overrideguesttraffic]').css('display', 'none');
10190- $vsmFields .hide();
10191- $vsmReqFields .hide();
10188+ $nexusDvsOptFields .hide();
10189+ $nexusDvsReqFields .hide();
1019210190 }
1019310191
1019410192 if ($form.find('.form-item[rel=overridepublictraffic]').css('display') != 'none' && $overridePublicTraffic.is(':checked')) {
1039610394 vSwitchPublicType: {
1039710395 label: 'Public Traffic vSwitch Type',
1039810396 select: function(args) {
10399- var vSwitchEnabled = false;
10397+ var useNexusDvs = false;
1040010398 var items = []
1040110399 $.ajax({
1040210400 url: createURL('listConfigurations'),
@@ -10406,12 +10404,12 @@
1040610404 async: false,
1040710405 success: function(json) {
1040810406 if (json.listconfigurationsresponse.configuration[0].value == 'true') {
10409- vSwitchEnabled = true;
10407+ useNexusDvs = true;
1041010408 }
1041110409 }
1041210410 });
1041310411
10414- if (vSwitchEnabled ) {
10412+ if (useNexusDvs ) {
1041510413 items.push({
1041610414 id: "nexusdvs",
1041710415 description: "Cisco Nexus 1000v Distributed Virtual Switch"
1046510463 select: function(args) {
1046610464 var items = []
1046710465
10468- var vSwitchEnabled = false;
10466+ var useNexusDvs = false;
1046910467 $.ajax({
1047010468 url: createURL('listConfigurations'),
1047110469 data: {
@@ -10474,13 +10472,13 @@
1047410472 async: false,
1047510473 success: function(json) {
1047610474 if (json.listconfigurationsresponse.configuration[0].value == 'true') {
10477- vSwitchEnabled = true;
10475+ useNexusDvs = true;
1047810476 }
1047910477 }
1048010478 });
1048110479
1048210480
10483- if (vSwitchEnabled ) {
10481+ if (useNexusDvs ) {
1048410482 items.push({
1048510483 id: "nexusdvs",
1048610484 description: "Cisco Nexus 1000v Distributed Virtual Switch"
0 commit comments