Provide Nexus vSwitch fields on add cluster form, if on VMware
hypervisor and vSwitch is enabled in configuration
This commit is contained in:
Brian Federle 2012-05-23 13:07:00 -07:00
parent 1ab26e11de
commit 1e1eb45b0f
1 changed files with 54 additions and 1 deletions

View File

@ -651,8 +651,34 @@
}
});
var vSwitchEnabled = false;
// Check whether vSwitch capability is enabled
$.ajax({
url: createURL('listConfigurations'),
data: {
name: 'vmware.use.nexus.vswitch'
},
async: false,
success: function(json) {
if (json.listconfigurationsresponse.configuration[0].value == 'true') {
vSwitchEnabled = true;
}
}
});
args.$select.bind("change", function(event) {
var $form = $(this).closest('form');
var $vsmFields = $form.find('[rel]').filter(function() {
var vsmFields = [
'vsmipaddress',
'vsmusername',
'vsmpassword'
];
return $.inArray($(this).attr('rel'), vsmFields) > -1;
});
if($(this).val() == "VMware") {
//$('li[input_sub_group="external"]', $dialogAddCluster).show();
$form.find('[rel=vCenterHost]').css('display', 'block');
@ -660,6 +686,11 @@
$form.find('[rel=vCenterPassword]').css('display', 'block');
$form.find('[rel=vCenterDatacenter]').css('display', 'block');
if (vSwitchEnabled) {
$vsmFields.css('display', 'block');
} else {
$vsmFields.css('display', 'none');
}
//$("#cluster_name_label", $dialogAddCluster).text("vCenter Cluster:");
}
else {
@ -696,7 +727,23 @@
vCenterDatacenter: {
label: 'label.vcenter.datacenter',
validation: { required: true }
}
},
vsmipaddress: {
label: 'vSwitch IP Address',
validation: { required: true },
isHidden: true
},
vsmusername: {
label: 'vSwitch Username',
validation: { required: true },
isHidden: true
},
vsmpassword: {
label: 'vSwitch Password',
validation: { required: true },
isPassword: true,
isHidden: true
}
//hypervisor==VMWare ends here
}
},
@ -2508,6 +2555,12 @@
array1.push("&username=" + todb(args.data.cluster.vCenterUsername));
array1.push("&password=" + todb(args.data.cluster.vCenterPassword));
if (args.data.cluster.vsmipaddress) { // vSwitch is enabled
array1.push('&vsmipaddress=' + args.data.cluster.vsmipaddress);
array1.push('&vsmusername=' + args.data.cluster.vsmusername);
array1.push('&vsmpassword=' + args.data.cluster.vsmpassword);
}
var hostname = args.data.cluster.vCenterHost;
var dcName = args.data.cluster.vCenterDatacenter;