cloudstack 3.0 UI - VPC - create tier dialog - check all tiers under the VPC. If any of them includes LB service, exclude network offering including LB service from network offering dropdown.

This commit is contained in:
Jessica Wang 2012-07-11 16:00:25 -07:00
parent 1e407f62ad
commit d0b8e59ab4
1 changed files with 55 additions and 34 deletions

View File

@ -1127,47 +1127,68 @@
validation: { required: true }, validation: { required: true },
dependsOn: 'zoneId', dependsOn: 'zoneId',
select: function(args) { select: function(args) {
//debugger;
//args.context is null (Brian will fix it to have value)
/*
var networkSupportingLbExists = false; var networkSupportingLbExists = false;
$.ajax({ $.ajax({
url: createURL('listNetworks'), url: createURL('listNetworks'),
data: { data: {
vpcid: args.context.vpc[0].id, vpcid: args.context.vpc[0].id,
supportedservices: LB supportedservices: 'LB'
}, },
async: false,
success: function(json) { success: function(json) {
if(json.listnetworksresponse.network != null && json.listnetworksresponse.network.length > 0) { var networkSupportingLbExists;
if(json.listnetworksresponse.network != null && json.listnetworksresponse.network.length > 0)
networkSupportingLbExists = true; networkSupportingLbExists = true;
} else
} networkSupportingLbExists = false;
});
*/
$.ajax({ //???
url: createURL('listNetworkOfferings'), $.ajax({
data: { url: createURL('listNetworkOfferings'),
forvpc: true, data: {
zoneid: args.zoneId, forvpc: true,
guestiptype: 'Isolated', zoneid: args.zoneId,
supportedServices: 'SourceNat', guestiptype: 'Isolated',
specifyvlan: false, supportedServices: 'SourceNat',
state: 'Enabled' specifyvlan: false,
}, state: 'Enabled'
success: function(json) { },
var networkOfferings = json.listnetworkofferingsresponse.networkoffering; success: function(json) {
args.response.success({ var networkOfferings = json.listnetworkofferingsresponse.networkoffering;
data: $.map(networkOfferings, function(zone) {
return { var items;
id: zone.id, if(networkSupportingLbExists == true) {
description: zone.name items = $.grep(networkOfferings, function(networkOffering) {
}; var includingLbService = false;
}) $(networkOffering.service).each(function(){
var thisService = this;
if(thisService.name == "Lb") {
includingLbService = true;
return false; //break $.each() loop
}
});
return !includingLbService;
});
}
else {
items = networkOfferings;
}
args.response.success({
data: $.map(items, function(item) {
return {
id: item.id,
description: item.name
};
})
});
}
}); });
//???
} }
}); });
} }
}, },
gateway: { gateway: {