Updated Branches:
  refs/heads/master b2d2f2c05 -> 086f880b3

CLOUDSTACK-4142: UI > VPC > IP Address > get service list from listNetworks API 
response instead of listNetworkOfferings API response.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/086f880b
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/086f880b
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/086f880b

Branch: refs/heads/master
Commit: 086f880b337157b451479bb426414f671daa2122
Parents: b2d2f2c
Author: Jessica Wang <[email protected]>
Authored: Tue Aug 13 17:55:36 2013 -0700
Committer: Jessica Wang <[email protected]>
Committed: Tue Aug 13 17:58:15 2013 -0700

----------------------------------------------------------------------
 ui/scripts/network.js | 47 ++++++++++++++++++++++------------------------
 ui/scripts/vpc.js     |  2 +-
 2 files changed, 23 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/086f880b/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index 2e9bd0e..5642995 100755
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -2657,7 +2657,7 @@
                                         var havingLbService = false;
                                         var havingVpnService = false;
 
-                                        if ('networks' in args.context && 
args.context.networks[0].vpcid == null) { //a non-VPC network from Guest 
Network section
+                                        if (!('vpc' in args.context)) { //from 
Guest Network section
                                             var services = 
args.context.networks[0].service;
                                             if(services != null) {
                                                for(var i = 0; i < 
services.length; i++) {                                              
@@ -2672,7 +2672,8 @@
                                                         havingVpnService = 
true;                                                                           
            
                                                }
                                             }  
-                                        } else { //a VPC network from Guest 
Network section or from VPC section
+                                        } else { //from VPC section
+                                               //a VPC network from Guest 
Network section or from VPC section
                                             // Firewall is not supported in IP 
from VPC section
                                             // (because ACL has already 
supported in tier from VPC section)
                                             havingFirewallService = false;
@@ -2692,29 +2693,25 @@
                                                     },
                                                     async: false,
                                                     success: function(json) {
-                                                        var networkObj = 
json.listnetworksresponse.network[0];
-                                                        $.ajax({
-                                                            url: 
createURL("listNetworkOfferings&id=" + networkObj.networkofferingid),
-                                                            async: false,
-                                                            success: 
function(json) {
-                                                                var 
networkoffering = json.listnetworkofferingsresponse.networkoffering[0];
-                                                                
$(networkoffering.service).each(function() {
-                                                                    var 
thisService = this;
-                                                                    if 
(thisService.name == "PortForwarding")
-                                                                        
havingPortForwardingService = true;
-                                                                    if 
(thisService.name == "Lb")
-                                                                        
havingLbService = true;
-                                                                });
-                                                            }
-                                                        });
+                                                        var networkObj = 
json.listnetworksresponse.network[0];                                           
         
+                                                        var services = 
networkObj.service;
+                                                        if(services != null) {
+                                                               for(var i = 0; 
i < services.length; i++) {
+                                                                       if 
(services[i].name == "PortForwarding")
+                                                                    
havingPortForwardingService = true;
+                                                                if 
(services[i].name == "Lb")
+                                                                    
havingLbService = true;
+                                                               }
+                                                        }                      
                          
                                                     }
                                                 });
                                             }
                                         }
+                                        
                                         if 
(args.context.networks[0].networkofferingconservemode == false) {
                                             /*
-                       (1) If IP is SourceNat, no 
StaticNat/VPN/PortForwarding/LoadBalancer can be enabled/added.
-                       */
+                                                               (1) If IP is 
SourceNat, no StaticNat/VPN/PortForwarding/LoadBalancer can be enabled/added.
+                                                               */
                                             if 
(args.context.ipAddresses[0].issourcenat) {
                                                 if (havingFirewallService == 
false) { //firewall is not supported in IP from VPC section (because ACL has 
already supported in tier from VPC section)
                                                     
disallowedActions.push("firewall");
@@ -2725,12 +2722,12 @@
                                             }
 
                                             /*
-                       (2) If IP is non-SourceNat, show 
StaticNat/VPN/PortForwarding/LoadBalancer at first.
-                       1. Once StaticNat is enabled, hide 
VPN/PortForwarding/LoadBalancer.
-                       2. If VPN service is supported (i.e. IP comes from 
Guest Network section, not from VPC section), once VPN is enabled, hide 
StaticNat/PortForwarding/LoadBalancer.
-                       3. Once a PortForwarding rule is added, hide 
StaticNat/VPN/LoadBalancer.
-                       4. Once a LoadBalancer rule is added, hide 
StaticNat/VPN/PortForwarding.
-                       */
+                                                               (2) If IP is 
non-SourceNat, show StaticNat/VPN/PortForwarding/LoadBalancer at first.
+                                                               1. Once 
StaticNat is enabled, hide VPN/PortForwarding/LoadBalancer.
+                                                               2. If VPN 
service is supported (i.e. IP comes from Guest Network section, not from VPC 
section), once VPN is enabled, hide StaticNat/PortForwarding/LoadBalancer.
+                                                               3. Once a 
PortForwarding rule is added, hide StaticNat/VPN/LoadBalancer.
+                                                               4. Once a 
LoadBalancer rule is added, hide StaticNat/VPN/PortForwarding.
+                                                               */
                                             else { 
//args.context.ipAddresses[0].issourcenat == false
                                                 if (havingFirewallService == 
false)
                                                     
disallowedActions.push("firewall");

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/086f880b/ui/scripts/vpc.js
----------------------------------------------------------------------
diff --git a/ui/scripts/vpc.js b/ui/scripts/vpc.js
index f6b2a76..bf854d2 100644
--- a/ui/scripts/vpc.js
+++ b/ui/scripts/vpc.js
@@ -1155,7 +1155,7 @@
                                 forloadbalancing: true
                             },
                             success: function(json) {
-                                var items = json.listpublicipaddressesresponse;
+                                var items = 
json.listpublicipaddressesresponse.publicipaddress;
                                 args.response.success({
                                     data: items
                                 });

Reply via email to