Updated Branches:
  refs/heads/4.2 d4ebd51c2 -> e6d03f232

CLOUDSTACK-4142: listNetworkOfferings API has been changed to not return 
system-owned network offerings to regular user(domain user). This API change 
causes several UI bugs. Change Edit Network action, Configuration tab of IP 
Address detailsView, to get network services 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/e6d03f23
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e6d03f23
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e6d03f23

Branch: refs/heads/4.2
Commit: e6d03f2322822aee331a1a2aa60190c4c755c402
Parents: d4ebd51
Author: Jessica Wang <jessicaw...@apache.org>
Authored: Fri Aug 9 15:51:46 2013 -0700
Committer: Jessica Wang <jessicaw...@apache.org>
Committed: Fri Aug 9 15:51:46 2013 -0700

----------------------------------------------------------------------
 ui/scripts/network.js | 57 +++++++++++++++++-----------------------------
 1 file changed, 21 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e6d03f23/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index 2c501aa..53580a6 100755
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -1168,20 +1168,13 @@
                                                     });
                                                 }
                                             });
-                                            $.ajax({
-                                                url: 
createURL("listNetworkOfferings&id=" + 
args.context.networks[0].networkofferingid), //include currently selected 
network offeirng to dropdown
-                                                dataType: "json",
-                                                async: false,
-                                                success: function(json) {
-                                                    var networkOfferingObjs = 
json.listnetworkofferingsresponse.networkoffering;
-                                                    
$(networkOfferingObjs).each(function() {
-                                                        items.push({
-                                                            id: this.id,
-                                                            description: 
this.displaytext
-                                                        });
-                                                    });
-                                                }
-                                            });
+                                                                               
         
+                                            //include currently selected 
network offeirng to dropdown
+                                            items.push({
+                                                id: 
args.context.networks[0].networkofferingid,
+                                                description: 
args.context.networks[0].networkofferingdisplaytext
+                                            });                                
                                                   
+                                          
                                             args.response.success({
                                                 data: items
                                             });
@@ -2707,28 +2700,20 @@
                                         var havingVpnService = false;
 
                                         if ('networks' in args.context && 
args.context.networks[0].vpcid == null) { //a non-VPC network from Guest 
Network section
-                                            $.ajax({
-                                                url: 
createURL('listNetworkOfferings'),
-                                                data: {
-                                                    listAll: true,
-                                                    id: 
args.context.networks[0].networkofferingid
-                                                },
-                                                async: false,
-                                                success: function(json) {
-                                                    var networkoffering = 
json.listnetworkofferingsresponse.networkoffering[0];
-                                                    
$(networkoffering.service).each(function() {
-                                                        var thisService = this;
-                                                        if (thisService.name 
== "Firewall")
-                                                            
havingFirewallService = true;
-                                                        if (thisService.name 
== "PortForwarding")
-                                                            
havingPortForwardingService = true;
-                                                        if (thisService.name 
== "Lb")
-                                                            havingLbService = 
true;
-                                                        if (thisService.name 
== "Vpn")
-                                                            havingVpnService = 
true;
-                                                    });
-                                                }
-                                            });
+                                            var services = 
args.context.networks[0].service;
+                                            if(services != null) {
+                                               for(var i = 0; i < 
services.length; i++) {                                              
+                                                       var thisService = 
services[i];
+                                                       if (thisService.name == 
"Firewall")
+                                                        havingFirewallService 
= true;
+                                                    if (thisService.name == 
"PortForwarding")
+                                                        
havingPortForwardingService = true;
+                                                    if (thisService.name == 
"Lb")
+                                                        havingLbService = true;
+                                                    if (thisService.name == 
"Vpn")
+                                                        havingVpnService = 
true;                                                                           
            
+                                               }
+                                            }  
                                         } else { //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)

Reply via email to