Updated Branches: refs/heads/ui-mixed-zone-management fa8b83581 -> d146f3d93
CLOUDSTACK-2038: cloudstack UI - mixed zone management - instance wizard. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/d146f3d9 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/d146f3d9 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/d146f3d9 Branch: refs/heads/ui-mixed-zone-management Commit: d146f3d93aef1ea0b95ad3f6b81647fe926f5d53 Parents: fa8b835 Author: Jessica Wang <jessica.w...@citrix.com> Authored: Mon Apr 15 13:55:51 2013 -0700 Committer: Jessica Wang <jessica.w...@citrix.com> Committed: Mon Apr 15 13:55:51 2013 -0700 ---------------------------------------------------------------------- ui/scripts/instanceWizard.js | 37 +++++++++++++++++++++++++++---------- 1 files changed, 27 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d146f3d9/ui/scripts/instanceWizard.js ---------------------------------------------------------------------- diff --git a/ui/scripts/instanceWizard.js b/ui/scripts/instanceWizard.js index e1aeafd..13828c8 100644 --- a/ui/scripts/instanceWizard.js +++ b/ui/scripts/instanceWizard.js @@ -70,14 +70,19 @@ steps: [ // 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' - }]; + function(args) { + if(args.initArgs.pluginForm != null && args.initArgs.pluginForm.name == "vpcTierInstanceWizard") { //from VPC Tier chart (VPC is only available in Advanced zone) + if(args.context.zoneType == 'Basic'){ //Basic type + zoneObjs = []; + } + else { //Advanced type or all types + //populate only one zone to the dropdown, the zone which the VPC is under. (networktype should be 'Advanced' since VPC is only available in Advanced zone) + 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 @@ -85,8 +90,20 @@ url: createURL("listZones&available=true"), dataType: "json", async: false, - success: function(json) { - zoneObjs = json.listzonesresponse.zone; + success: function(json) { + if(args.context.zoneType == null || args.context.zoneType == '') { //all types + zoneObjs = json.listzonesresponse.zone; + } + else { //Basic type or Advanced type + zoneObjs = []; + var items = json.listzonesresponse.zone; + if(items != null) { + for(var i = 0; i < items.length; i++) { + if(items[i].networktype == args.context.zoneType) + zoneObjs.push(items[i]); + } + } + } args.response.success({ data: {zones: zoneObjs}}); } });