From 8df1cfe087ae991152d35e9907f897808916448e Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Mon, 30 Jan 2012 15:38:14 -0800 Subject: [PATCH] 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. --- ui/scripts/configuration.js | 39 ++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/ui/scripts/configuration.js b/ui/scripts/configuration.js index 4af43a33602..7836bd6fa5d 100644 --- a/ui/scripts/configuration.js +++ b/ui/scripts/configuration.js @@ -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',