|
6079 | 6079 | hypervisor: { |
6080 | 6080 | label: 'label.hypervisor', |
6081 | 6081 | select: function(args) { |
| 6082 | + var vSwitchEnabled = false; |
| 6083 | + |
6082 | 6084 | $.ajax({ |
6083 | 6085 | url: createURL("listHypervisors"), |
6084 | 6086 | dataType: "json", |
|
6093 | 6095 | } |
6094 | 6096 | }); |
6095 | 6097 |
|
| 6098 | + // Check whether vSwitch capability is enabled |
| 6099 | + $.ajax({ |
| 6100 | + url: createURL('listConfigurations'), |
| 6101 | + data: { |
| 6102 | + name: 'vmware.use.nexus.vswitch' |
| 6103 | + }, |
| 6104 | + async: false, |
| 6105 | + success: function(json) { |
| 6106 | + if (json.listconfigurationsresponse.configuration[0].value == 'true') { |
| 6107 | + vSwitchEnabled = true; |
| 6108 | + } |
| 6109 | + } |
| 6110 | + }); |
| 6111 | + |
6096 | 6112 | args.$select.bind("change", function(event) { |
6097 | 6113 | var $form = $(this).closest('form'); |
6098 | | - if($(this).val() == "VMware") { |
| 6114 | + var $vsmFields = $.merge( |
| 6115 | + $form.find('.form-item[rel=vsmipaddress]'), |
| 6116 | + $form.find('.form-item[rel=vsmusername]'), |
| 6117 | + $form.find('.form-item[rel=vsmpassword]') |
| 6118 | + ); |
| 6119 | + |
| 6120 | + if ($(this).val() == "VMware") { |
6099 | 6121 | //$('li[input_sub_group="external"]', $dialogAddCluster).show(); |
6100 | 6122 | $form.find('.form-item[rel=vCenterHost]').css('display', 'inline-block'); |
6101 | 6123 | $form.find('.form-item[rel=vCenterUsername]').css('display', 'inline-block'); |
6102 | 6124 | $form.find('.form-item[rel=vCenterPassword]').css('display', 'inline-block'); |
6103 | 6125 | $form.find('.form-item[rel=vCenterDatacenter]').css('display', 'inline-block'); |
6104 | | - $form.find('.form-item[rel=enableNexusVswitch]').css('display', 'inline-block'); |
6105 | 6126 |
|
6106 | | - //$("#cluster_name_label", $dialogAddCluster).text("vCenter Cluster:"); |
6107 | | - } |
6108 | | - else { |
6109 | | - //$('li[input_group="vmware"]', $dialogAddCluster).hide(); |
| 6127 | + if (vSwitchEnabled) { |
| 6128 | + $vsmFields.css('display', 'inline-block'); |
| 6129 | + } else { |
| 6130 | + $vsmFields.css('display', 'none'); |
| 6131 | + } |
| 6132 | + } else { |
6110 | 6133 | $form.find('.form-item[rel=vCenterHost]').css('display', 'none'); |
6111 | 6134 | $form.find('.form-item[rel=vCenterUsername]').css('display', 'none'); |
6112 | 6135 | $form.find('.form-item[rel=vCenterPassword]').css('display', 'none'); |
6113 | 6136 | $form.find('.form-item[rel=vCenterDatacenter]').css('display', 'none'); |
6114 | 6137 | $form.find('.form-item[rel=enableNexusVswitch]').css('display', 'none'); |
6115 | | - $('.form-item[rel=enableNexusVswitch] input').attr('checked', false); |
6116 | | - $form.find('.form-item[rel=nexusVswitchIpAddress]').css('display', 'none'); |
6117 | | - $form.find('.form-item[rel=nexusVswitchUsername]').css('display', 'none'); |
6118 | | - $form.find('.form-item[rel=nexusVswitchPassword]').css('display', 'none'); |
6119 | | - |
6120 | | - //$("#cluster_name_label", $dialogAddCluster).text("Cluster:"); |
| 6138 | + $vsmFields.css('display', 'none'); |
6121 | 6139 | } |
6122 | 6140 | }); |
6123 | 6141 | } |
|
6167 | 6185 | label: 'label.vcenter.datacenter', |
6168 | 6186 | validation: { required: true } |
6169 | 6187 | }, |
6170 | | - enableNexusVswitch: { |
6171 | | - label: 'Add Nexus vSwitch', |
6172 | | - isBoolean: true |
6173 | | - }, |
6174 | 6188 | vsmipaddress: { |
6175 | 6189 | label: 'vSwitch IP Address', |
6176 | | - dependsOn: 'enableNexusVswitch', |
6177 | 6190 | validation: { required: true }, |
6178 | 6191 | isHidden: true |
6179 | 6192 | }, |
6180 | 6193 | vsmusername: { |
6181 | 6194 | label: 'vSwitch Username', |
6182 | | - dependsOn: 'enableNexusVswitch', |
6183 | 6195 | validation: { required: true }, |
6184 | 6196 | isHidden: true |
6185 | 6197 | }, |
6186 | 6198 | vsmpassword: { |
6187 | 6199 | label: 'vSwitch Password', |
6188 | | - dependsOn: 'enableNexusVswitch', |
6189 | 6200 | validation: { required: true }, |
6190 | 6201 | isPassword: true, |
6191 | 6202 | isHidden: true |
|
0 commit comments