Updated Branches:
  refs/heads/4.2 e50eb3def -> 674552269

CLOUDSTACK-4142: listNetworkOfferings API has been changed to not return system 
owned network offerings to regular user. Therefore, change VPC tier detailView 
to get 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/67455226
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/67455226
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/67455226

Branch: refs/heads/4.2
Commit: 674552269a341a327fd9ecd26465095bf3cbd4af
Parents: e50eb3d
Author: Jessica Wang <[email protected]>
Authored: Wed Aug 14 11:09:21 2013 -0700
Committer: Jessica Wang <[email protected]>
Committed: Wed Aug 14 11:09:21 2013 -0700

----------------------------------------------------------------------
 ui/scripts/vpc.js | 48 +++++++++++++++++++++++-------------------------
 1 file changed, 23 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67455226/ui/scripts/vpc.js
----------------------------------------------------------------------
diff --git a/ui/scripts/vpc.js b/ui/scripts/vpc.js
index af37873..4ec158f 100644
--- a/ui/scripts/vpc.js
+++ b/ui/scripts/vpc.js
@@ -3325,32 +3325,30 @@
                 },
 
                 tabFilter: function(args) {
-                    var networkOfferingHavingELB = false;
-                    $.ajax({
-                        url: createURL("listNetworkOfferings&id=" + 
args.context.networks[0].networkofferingid),
-                        dataType: "json",
-                        async: false,
-                        success: function(json) {
-                            var networkoffering = 
json.listnetworkofferingsresponse.networkoffering[0];
-                            $(networkoffering.service).each(function() {
-                                var thisService = this;
-                                if (thisService.name == "Lb") {
-                                    $(thisService.capability).each(function() {
-                                        if (this.name == "ElasticLb" && 
this.value == "true") {
-                                            networkOfferingHavingELB = true;
-                                            return false; //break $.each() loop
-                                        }
-                                    });
-                                    return false; //break $.each() loop
-                                }
-                            });
-                        }
-                    });
-
-                    var hiddenTabs = ['ipAddresses', 'acl']; // Disable IP 
address tab; it is redundant with 'view all' button
-
-                    if (networkOfferingHavingELB == false)
+                       var hiddenTabs = ['ipAddresses', 'acl']; // Disable IP 
address tab; it is redundant with 'view all' button
+                       
+                       var networkOfferingHavingELB = false;                   
                    
+                    var services = args.context.networks[0].service;
+                    if(services != null) {
+                       for(var i = 0; i < services.length; i++) {              
                
+                               if (services[i].name == "Lb") {
+                                       var capabilities = 
services[i].capability;
+                                       if(capabilities != null) {
+                                               for(var k = 0; k < 
capabilities.length; k++) {
+                                                       if(capabilities[k].name 
== "ElasticLb") {
+                                                               
networkOfferingHavingELB = true;
+                                                               break;          
                                                
+                                                       }
+                                               }
+                                       }  
+                                break;
+                            }                                  
+                       }
+                    }   
+                    if (networkOfferingHavingELB == false) {
                         hiddenTabs.push("addloadBalancer");
+                    }
+                    
                     return hiddenTabs;
                 },
 

Reply via email to