CLOUDSTACK-747: internalLb in VPC - UI - create network offering - when VPC checkbox is checked, enable provider InternalLbVm, VpcVirtualRouter, Netscaler. When VPC checkbox is unchecked, disable provider InternalLbVm, VpcVirtualRouter.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/263cc9a6 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/263cc9a6 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/263cc9a6 Branch: refs/heads/vmware-datamodel Commit: 263cc9a62c731a22518056a601c9c57fb3777690 Parents: e42ddb8 Author: Jessica Wang <jessicaw...@apache.org> Authored: Tue May 21 10:57:12 2013 -0700 Committer: Jessica Wang <jessicaw...@apache.org> Committed: Tue May 21 11:44:20 2013 -0700 ---------------------------------------------------------------------- ui/scripts/configuration.js | 41 ++++++++++++++++++++++++++----------- 1 files changed, 29 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/263cc9a6/ui/scripts/configuration.js ---------------------------------------------------------------------- diff --git a/ui/scripts/configuration.js b/ui/scripts/configuration.js index 058f440..7485898 100644 --- a/ui/scripts/configuration.js +++ b/ui/scripts/configuration.js @@ -1436,20 +1436,37 @@ docID: 'helpNetworkOfferingVPC', isBoolean: true, onChange: function(args) { - var $checkbox = args.$checkbox; - var $selects = $checkbox.closest('form').find('.dynamic-input select'); - var $vpcOptions = $selects.find('option[value=VpcVirtualRouter]'); + var $vpc = args.$checkbox; + var $providers = $vpc.closest('form').find('.dynamic-input select'); + var $optionsOfProviders = $providers.find('option'); - if ($checkbox.is(':checked')) { - $vpcOptions.siblings().attr('disabled', true); - $selects.val('VpcVirtualRouter'); - } else { - $vpcOptions.siblings().attr('disabled', false); - $vpcOptions.attr('disabled', true); - $selects.each(function() { - $(this).val($(this).find('option:first')); - }); + //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')); + }); + } },