CLOUDSTACK-2038: cloudstack UI - mixed zone management - instance wizard.

This commit is contained in:
Jessica Wang 2013-04-15 13:55:51 -07:00
parent fa8b83581b
commit d146f3d93a

View File

@ -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}});
}
});