bug 12869: create network offering dialog - 1. When guestIpType is Shared, hide SpecifyVlan checkbox (pass specifyVlan=true, specifyIpRanges=true to API call).

2. When guestIpType is Isolated, show SpecifyVlan checkbox.
   If SpecifyVlan checkbox is checked (specifyVlan=true), specifyIpRanges=true.
   If SpecifyVlan checkbox is unchecked (specifyVlan=false), specifyIpRanges=false.
3. remove SpecifyIpRanges checkbox.
This commit is contained in:
Jessica Wang 2012-01-30 15:38:14 -08:00
parent cd56bf9f60
commit 8df1cfe087

View File

@ -1085,17 +1085,22 @@
return key;
}).join(',');
if (inputData['specifyVlan'] == 'on') {
inputData['specifyVlan'] = true;
} else {
inputData['specifyVlan'] = false;
}
if (inputData['specifyIpRanges'] == 'on') {
inputData['specifyIpRanges'] = true;
} else {
inputData['specifyIpRanges'] = false;
}
if(inputData['guestIpType'] == "Shared"){ //specifyVlan checkbox is hidden
inputData['specifyVlan'] = true;
inputData['specifyIpRanges'] = true;
}
else if (inputData['guestIpType'] == "Isolated") { //specifyVlan checkbox is shown
if (inputData['specifyVlan'] == 'on') { //specifyVlan checkbox is checked
inputData['specifyVlan'] = true;
inputData['specifyIpRanges'] = true;
}
else { //specifyVlan checkbox is unchecked
inputData['specifyVlan'] = false;
inputData['specifyIpRanges'] = false;
}
}
if (inputData['conservemode'] == 'on') {
inputData['conservemode'] = true;
@ -1159,6 +1164,16 @@
{ id: 'Shared', description: 'Shared' }
]
});
args.$select.change(function() {
var $form = $(this).closest("form");
if($(this).val() == "Shared") {
$form.find('.form-item[rel=specifyVlan]').hide();
}
else { //$(this).val() == "Isolated"
$form.find('.form-item[rel=specifyVlan]').css('display', 'inline-block');
}
});
}
},
@ -1207,9 +1222,7 @@
}
},
specifyVlan: { label: 'Specify VLAN', isBoolean: true },
specifyIpRanges: { label: 'Specify IP ranges', isBoolean: true },
specifyVlan: { label: 'Specify VLAN', isBoolean: true },
supportedServices: {
label: 'Supported Services',