Updated Branches:
  refs/heads/master da83e12d6 -> aebcec256

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/aebcec25
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/aebcec25
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/aebcec25

Branch: refs/heads/master
Commit: aebcec256e42e1769fbadac94be981c4876d586e
Parents: da83e12
Author: Jessica Wang <[email protected]>
Authored: Wed Aug 14 11:09:21 2013 -0700
Committer: Jessica Wang <[email protected]>
Committed: Wed Aug 14 11:13:34 2013 -0700

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/aebcec25/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