CLOUDSTACK-475: cloudstack UI - create network offering - Hide VPC checkbox when Guest Type is Shared. Show it when Guest Type is Isolated.

This commit is contained in:
Jessica Wang 2012-11-13 16:44:02 -08:00
parent 9dea5f5fc1
commit 0f7266767e

View File

@ -1132,7 +1132,21 @@
//check whether to show or hide availability field
var $sourceNATField = args.$form.find('input[name=\"service.SourceNat.isEnabled\"]');
var $guestTypeField = args.$form.find('select[name=guestIpType]');
if($guestTypeField.val() == 'Shared') { //Shared network offering
args.$form.find('.form-item[rel=\"useVpc\"]').hide();
var $useVpcCb = args.$form.find('.form-item[rel=\"useVpc\"]').find("input[type=checkbox]");
if($useVpcCb.is(':checked')) { //if useVpc is checked,
$useVpcCb.removeAttr("checked"); //remove "checked" attribute in useVpc
$useVpcCb.trigger("click"); //trigger useVpc.onChange()
}
}
else { //Isolated network offering
args.$form.find('.form-item[rel=\"useVpc\"]').css('display', 'inline-block');
}
if (!requiredNetworkOfferingExists &&
$sourceNATField.is(':checked') &&
$guestTypeField.val() == 'Isolated') {
@ -1367,7 +1381,7 @@
var $checkbox = args.$checkbox;
var $selects = $checkbox.closest('form').find('.dynamic-input select');
var $vpcOptions = $selects.find('option[value=VpcVirtualRouter]');
if ($checkbox.is(':checked')) {
$vpcOptions.siblings().attr('disabled', true);
$selects.val('VpcVirtualRouter');