DV Switch UI Integration -Set 1

This commit is contained in:
Pranav Saxena 2013-02-27 14:53:07 +05:30
parent f30da781f8
commit 1b94047bd8
2 changed files with 113 additions and 2 deletions

View File

@ -7347,6 +7347,7 @@
docID: 'helpClusterHypervisor',
select: function(args) {
var vSwitchEnabled = false;
var dvSwitchEnabled = false;
$.ajax({
url: createURL("listHypervisors"),
@ -7375,6 +7376,21 @@
}
}
});
//Check whether dvSwitch is enabled or not
$.ajax({
url: createURL('listConfigurations'),
data: {
name: 'vmware.use.dvswitch'
},
async: false,
success: function(json) {
if (json.listconfigurationsresponse.configuration[0].value == 'true') {
dvSwitchEnabled = true;
}
}
});
args.$select.bind("change", function(event) {
var $form = $(this).closest('form');
@ -7390,6 +7406,16 @@
if ($(this).val() == "VMware") {
//$('li[input_sub_group="external"]', $dialogAddCluster).show();
if(dvSwitchEnabled ){
$form.find('.form-item[rel=vSwitchPublicType]').css('display', 'inline-block');
$form.find('.form-item[rel=vSwitchGuestType]').css('display', 'inline-block');
}
else {
$form.find('.form-item[rel=vSwitchPublicType]').css('display', 'none');
$form.find('.form-item[rel=vSwitchGuestType]').css('display', 'none');
}
$form.find('.form-item[rel=vCenterHost]').css('display', 'inline-block');
$form.find('.form-item[rel=vCenterUsername]').css('display', 'inline-block');
$form.find('.form-item[rel=vCenterPassword]').css('display', 'inline-block');
@ -7453,6 +7479,31 @@
},
//hypervisor==VMWare begins here
vSwitchPublicType:{
label: 'Public Traffic vSwitch Type',
select: function(args) {
var items = []
items.push({id: "" , description:" " });
items.push({id: "vmwaresvs", description: "VMware vNetwork Standard Virtual Switch"});
items.push({id: "vmwaredvs", description: "VMware vNetwork Distributed Virtual Switch"});
args.response.success({data: items});
},
isHidden:true
},
vSwitchGuestType:{
label: 'Guest Traffic vSwitch Type',
select: function(args) {
var items = []
items.push({id: "" , description:" " });
items.push({id: "vmwaresvs", description: "VMware vNetwork Standard Virtual Switch"});
items.push({id: "vmwaredvs", description: "VMware vNetwork Distributed Virtual Switch"});
args.response.success({data: items});
},
isHidden:true
},
vCenterHost: {
label: 'label.vcenter.host',
docID: 'helpClustervCenterHost',
@ -7519,6 +7570,13 @@
if(args.data.hypervisor == "VMware") {
array1.push("&username=" + todb(args.data.vCenterUsername));
array1.push("&password=" + todb(args.data.vCenterPassword));
if(args.data.vSwitchPublicType != "")
array1.push('&vswitchtypepublic=' + args.data.vSwitchPublicType);
if(args.data.vSwitchGuestType != "")
array1.push('&vswitchtypeguest=' + args.data.vSwitchGuestType);
if (args.data.vsmipaddress) {
array1.push('&vsmipaddress=' + args.data.vsmipaddress);

View File

@ -732,7 +732,7 @@
});
var vSwitchEnabled = false;
var dvSwitchEnabled = false;
// Check whether vSwitch capability is enabled
$.ajax({
url: createURL('listConfigurations'),
@ -747,6 +747,17 @@
}
});
//Check whether dvSwitch is enabled or not
$.ajax({
url: createURL('listConfigurations'),
data: {
name: 'vmware.use.dvswitch'
},
async: false,
success: function(json) { if (json.listconfigurationsresponse.configuration[0].value == 'true') { dvSwitchEnabled = true;
}
} });
args.$select.bind("change", function(event) {
var $form = $(this).closest('form');
var $vsmFields = $form.find('[rel]').filter(function() {
@ -761,6 +772,15 @@
if($(this).val() == "VMware") {
//$('li[input_sub_group="external"]', $dialogAddCluster).show();
if(dvSwitchEnabled ){
$form.find('.form-item[rel=vSwitchPublicType]').css('display', 'inline-block');
$form.find('.form-item[rel=vSwitchGuestType]').css('display', 'inline-block');
}
else {
$form.find('.form-item[rel=vSwitchPublicType]').css('display', 'none');
$form.find('.form-item[rel=vSwitchGuestType]').css('display', 'none');
}
$form.find('[rel=vCenterHost]').css('display', 'block');
$form.find('[rel=vCenterUsername]').css('display', 'block');
$form.find('[rel=vCenterPassword]').css('display', 'block');
@ -791,6 +811,32 @@
},
//hypervisor==VMWare begins here
vSwitchPublicType:{
label: 'Public Traffic vSwitch Type',
select: function(args) {
var items = []
items.push({id: " ", description: " "});
items.push({id: "vmwaresvs", description: "VMware vNetwork Standard Virtual Switch"});
items.push({id: "vmwaredvs", description: "VMware vNetwork Distributed Virtual Switch"});
args.response.success({data: items});
},
isHidden:true
},
vSwitchGuestType:{
label: 'Guest Traffic vSwitch Type',
select: function(args) {
var items = []
items.push({ id:" ", description:" "});
items.push({id: "vmwaresvs", description: "VMware vNetwork Standard Virtual Switch"});
items.push({id: "vmwaredvs", description: "VMware vNetwork Distributed Virtual Switch"});
args.response.success({data: items});
}, isHidden:true
},
vCenterHost: {
label: 'label.vcenter.host',
validation: { required: true }
@ -2917,7 +2963,14 @@
array1.push("&username=" + todb(args.data.cluster.vCenterUsername));
array1.push("&password=" + todb(args.data.cluster.vCenterPassword));
if (args.data.cluster.vsmipaddress) { // vSwitch is enabled
//dvswitch is enabled
if(args.data.cluster.vSwitchPublicType != "")
array1.push('&vswitchtypepublic=' + args.data.cluster.vSwitchPublicType);
if(args.data.cluster.vSwitchGuestType != "")
array1.push('&vswitchtypeguest=' + args.data.cluster.vSwitchGuestType);
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);