CLOUDSTACK-748: Support deployment of VM on Tier + network
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/d6ce2af2 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/d6ce2af2 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/d6ce2af2 Branch: refs/heads/Health-Check-UI Commit: d6ce2af209d4a5f34565243fe0ae03892486dea0 Parents: d579c93 Author: Brian Federle <brian.fede...@citrix.com> Authored: Wed Mar 13 15:13:19 2013 -0700 Committer: Brian Federle <brian.fede...@citrix.com> Committed: Thu Mar 14 12:53:39 2013 -0700 ---------------------------------------------------------------------- ui/scripts/instanceWizard.js | 14 +++++++++----- ui/scripts/ui-custom/instanceWizard.js | 27 +++++++++++++++++++++------ 2 files changed, 30 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d6ce2af2/ui/scripts/instanceWizard.js ---------------------------------------------------------------------- diff --git a/ui/scripts/instanceWizard.js b/ui/scripts/instanceWizard.js index d9260b0..75d45aa 100644 --- a/ui/scripts/instanceWizard.js +++ b/ui/scripts/instanceWizard.js @@ -33,11 +33,10 @@ // Called in networks list, when VPC drop-down is changed // -- if vpcID given, return true if in network specified by vpcID - // -- if vpcID == -1, return true if network is not associated with a VPC + // -- if vpcID == -1, always show all networks vpcFilter: function(data, vpcID) { - return vpcID != -1? - data.vpcid == vpcID : - !data.vpcid; + return vpcID != -1 ? + data.vpcid == vpcID : true; }, // Runs when advanced SG-enabled zone is run, before @@ -401,7 +400,12 @@ includingSecurityGroup = true; break; } - } + } + + if (networkObj.vpcid) { + networkObj._singleSelect = true; + } + //for Advanced SG-enabled zone, list only SG network offerings if(selectedZoneObj.networktype == 'Advanced' && selectedZoneObj.securitygroupsenabled == true) { if(includingSecurityGroup == false) http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d6ce2af2/ui/scripts/ui-custom/instanceWizard.js ---------------------------------------------------------------------- diff --git a/ui/scripts/ui-custom/instanceWizard.js b/ui/scripts/ui-custom/instanceWizard.js index 8e4ed7e..b55df79 100644 --- a/ui/scripts/ui-custom/instanceWizard.js +++ b/ui/scripts/ui-custom/instanceWizard.js @@ -91,7 +91,8 @@ options = options ? options : {}; $(data).each(function() { - var id = this[fields.id]; + var item = this; + var id = item[fields.id]; var $select = $('<div>') .addClass('select') @@ -107,17 +108,22 @@ .val(id) .click(function() { var $select = $(this).closest('.select'); + var isSingleSelect = $select.hasClass('single-select'); var $radio = $select.find('input[type=radio]'); var $newNetwork = $(this).closest('.content').find('.select.new-network'); var $otherSelects = $select.siblings().filter(':visible'); var isCheckbox = $(this).attr('type') == 'checkbox'; - var isSingleSelect = $(this).closest('.select-container').hasClass('single-select'); if (isCheckbox) { - if ((isSingleSelect || !$otherSelects.size()) && - $newNetwork.find('input[type=checkbox]').is(':unchecked')) { - $otherSelects.find('input[type=checkbox]').attr('checked', false); + if (isSingleSelect) { + $select.siblings('.single-select:visible').find('input[type=checkbox]') + .attr('checked', false); + + $(this).closest('.select').find('input[type=radio]').click(); + } + if ((!$otherSelects.size()) && + $newNetwork.find('input[type=checkbox]').is(':unchecked')) { // Set as default $(this).closest('.select').find('input[type=radio]').click(); } @@ -144,6 +150,10 @@ $selects.append($select); + if (item._singleSelect) { + $select.addClass('single-select'); + } + if (options.secondary) { var $secondary = $('<div>').addClass('secondary-input').append( $('<input>') @@ -164,6 +174,11 @@ $(this).closest('.select').siblings().find('input[type=checkbox]') .attr('checked', false); } + + if ($select.hasClass('single-select')) { + $select.siblings('.single-select:visible').find('input[type=checkbox]') + .attr('checked', false); + } }) .after( $('<div>').addClass('name').html(options.secondary.desc) @@ -614,7 +629,7 @@ }); // 'No VPC' option - $('<option>').attr('value', '-1').html('None').prependTo($vpcSelect); + $('<option>').attr('value', '-1').html(_l('ui.listView.filters.all')).prependTo($vpcSelect); $vpcSelect.val(-1);