From f2a927b9fa542b4008ed7cf82c26de98984efd80 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Thu, 9 Aug 2012 17:07:09 -0700 Subject: [PATCH] CS-15883: cloudstack 3.0 UI - VPC - VM Wizard - step 1 - zone dropdown - populate only one zone, the one that the VPC is under. --- ui/scripts/instanceWizard.js | 43 ++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/ui/scripts/instanceWizard.js b/ui/scripts/instanceWizard.js index d96cbb87f43..f4e43adca29 100644 --- a/ui/scripts/instanceWizard.js +++ b/ui/scripts/instanceWizard.js @@ -29,28 +29,29 @@ // Data providers for each wizard step steps: [ - // Step 1: Setup - function(args) { - $.ajax({ - url: createURL("listZones&available=true"), - dataType: "json", - async: false, - success: function(json) { - zoneObjs = json.listzonesresponse.zone; - - var items; - if(args.initArgs.pluginForm != null && args.initArgs.pluginForm.name == "vpcTierInstanceWizard") { //from VPC Tier chart - items = $.grep(zoneObjs, function(zoneObj) { - return zoneObj.networktype == 'Advanced'; - }); + + // Step 1: Setup + function(args) { + if(args.initArgs.pluginForm != null && args.initArgs.pluginForm.name == "vpcTierInstanceWizard") { //from VPC Tier chart + //populate only one zone to the dropdown, the zone which the VPC is under. + zoneObjs = [{ + id: args.context.vpc[0].zoneid, + name: args.context.vpc[0].zonename, + networktype: 'Advanced' + }]; + args.response.success({ data: {zones: zoneObjs}}); + } + else { //from Instance page + $.ajax({ + url: createURL("listZones&available=true"), + dataType: "json", + async: false, + success: function(json) { + zoneObjs = json.listzonesresponse.zone; + args.response.success({ data: {zones: zoneObjs}}); } - else { //from Instance page - items = zoneObjs; - } - - args.response.success({ data: {zones: items}}); - } - }); + }); + } }, // Step 2: Select template