You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mi...@apache.org on 2012/09/18 05:15:47 UTC
[2/3] git commit: CLOUDSTACK-114 UI - VPC related Network Offerings
should not be provided as options to create a guest network for the Account
before a VPC is actually present with the Account
CLOUDSTACK-114 UI - VPC related Network Offerings should not be provided as options to create a guest network for the Account before a VPC is actually present with the Account
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/11b42481
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/11b42481
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/11b42481
Branch: refs/heads/master
Commit: 11b42481e1ed5aea2cc971a49fa9bcb357d8b64f
Parents: cf5d7f8
Author: Mice Xia <mi...@tcloudcomputing.com>
Authored: Tue Sep 18 11:02:14 2012 +0800
Committer: Mice Xia <mi...@tcloudcomputing.com>
Committed: Tue Sep 18 11:18:44 2012 +0800
----------------------------------------------------------------------
ui/scripts/network.js | 45 +++++++++++++++++++++++++++++--------------
1 files changed, 30 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/11b42481/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index c6acc75..e1c32b4 100644
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -282,25 +282,40 @@
label: 'label.network.offering',
validation: { required: true },
dependsOn: 'zoneId',
- select: function(args) {
+ select: function(args) {
$.ajax({
- url: createURL('listNetworkOfferings&zoneid=' + args.zoneId),
+ url: createURL('listVPCs'),
data: {
- guestiptype: 'Isolated',
- supportedServices: 'SourceNat',
- specifyvlan: false,
- state: 'Enabled'
+ listAll: true
},
success: function(json) {
- networkOfferingObjs = json.listnetworkofferingsresponse.networkoffering;
- args.response.success({
- data: $.map(networkOfferingObjs, function(zone) {
- return {
- id: zone.id,
- description: zone.name
- };
- })
- });
+ var items = json.listvpcsresponse.vpc;
+ var baseUrl = 'listNetworkOfferings&zoneid=' + args.zoneId;
+ var listUrl;
+ if(items != null && items.length > 0)
+ listUrl = baseUrl;
+ else
+ listUrl = baseUrl + '&forVpc=false';
+ $.ajax({
+ url: createURL(listUrl),
+ data: {
+ guestiptype: 'Isolated',
+ supportedServices: 'SourceNat',
+ specifyvlan: false,
+ state: 'Enabled'
+ },
+ success: function(json) {
+ networkOfferingObjs = json.listnetworkofferingsresponse.networkoffering;
+ args.response.success({
+ data: $.map(networkOfferingObjs, function(zone) {
+ return {
+ id: zone.id,
+ description: zone.name
+ };
+ })
+ });
+ }
+ });
}
});
}