Updated Branches: refs/heads/master acc71fb73 -> b325f7d3b
CLOUDSTACK-2744: UI - create network offering dialog - when VPC checkbox is unchecked and LB service is checked, provider option InternalLbVm should be disabled. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b325f7d3 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b325f7d3 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b325f7d3 Branch: refs/heads/master Commit: b325f7d3bd6274c979549794d8155ffa1492924f Parents: acc71fb Author: Jessica Wang <[email protected]> Authored: Mon Jun 3 12:29:57 2013 -0700 Committer: Jessica Wang <[email protected]> Committed: Mon Jun 3 12:32:08 2013 -0700 ---------------------------------------------------------------------- ui/scripts/configuration.js | 72 +++++++++++++++++-------------------- 1 files changed, 33 insertions(+), 39 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b325f7d3/ui/scripts/configuration.js ---------------------------------------------------------------------- diff --git a/ui/scripts/configuration.js b/ui/scripts/configuration.js index 44f4095..cb15598 100644 --- a/ui/scripts/configuration.js +++ b/ui/scripts/configuration.js @@ -1193,19 +1193,46 @@ var $sourceNATField = args.$form.find('input[name=\"service.SourceNat.isEnabled\"]'); var $guestTypeField = args.$form.find('select[name=guestIpType]'); + //*** VPC checkbox *** var $useVpc = args.$form.find('.form-item[rel=\"useVpc\"]'); var $useVpcCb = $useVpc.find("input[type=checkbox]"); if($guestTypeField.val() == 'Shared') { //Shared network offering $useVpc.hide(); - if($useVpcCb.is(':checked')) { //if useVpc is checked, - $useVpcCb.removeAttr("checked"); //remove "checked" attribute in useVpc - $useVpcCb.trigger("click"); //trigger useVpc.onChange() + if($useVpcCb.is(':checked')) { //if useVpc is checked, + $useVpcCb.removeAttr("checked"); //remove "checked" attribute in useVpc } } else { //Isolated network offering $useVpc.css('display', 'inline-block'); - } - + } + var $providers = $useVpcCb.closest('form').find('.dynamic-input select'); + var $optionsOfProviders = $providers.find('option'); + //p.s. Netscaler is supported in both vpc and non-vpc + if ($useVpc.is(':visible') && $useVpcCb.is(':checked')) { //*** vpc *** + $optionsOfProviders.each(function(index) { + if($(this).val() == 'InternalLbVm' || $(this).val() == 'VpcVirtualRouter' || $(this).val() == 'Netscaler') { + $(this).attr('disabled', false); + } + else { + $(this).attr('disabled', true); + } + }); + } + else { //*** non-vpc *** + $optionsOfProviders.each(function(index) { + if($(this).val() == 'InternalLbVm' || $(this).val() == 'VpcVirtualRouter') { + $(this).attr('disabled', true); + } + else { + $(this).attr('disabled', false); + } + }); + } + $providers.each(function() { + $(this).val($(this).find('option:first')); + }); + + if (!requiredNetworkOfferingExists && $sourceNATField.is(':checked') && @@ -1523,40 +1550,7 @@ useVpc: { label: 'VPC', docID: 'helpNetworkOfferingVPC', - isBoolean: true, - onChange: function(args) { - var $vpc = args.$checkbox; - var $providers = $vpc.closest('form').find('.dynamic-input select'); - var $optionsOfProviders = $providers.find('option'); - - //p.s. Netscaler is supported in both vpc and non-vpc - - if ($vpc.is(':checked')) { //*** vpc *** - $optionsOfProviders.each(function(index) { - if($(this).val() == 'InternalLbVm' || $(this).val() == 'VpcVirtualRouter' || $(this).val() == 'Netscaler') { - $(this).attr('disabled', false); - } - else { - $(this).attr('disabled', true); - } - }); - } - else { //*** non-vpc *** - $optionsOfProviders.each(function(index) { - if($(this).val() == 'InternalLbVm' || $(this).val() == 'VpcVirtualRouter') { - $(this).attr('disabled', true); - } - else { - $(this).attr('disabled', false); - } - }); - } - - $providers.each(function() { - $(this).val($(this).find('option:first')); - }); - - } + isBoolean: true }, lbType: { //only shown when VPC is checked and LB service is checked
