You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by an...@apache.org on 2013/10/03 08:06:12 UTC

[14/50] git commit: updated refs/heads/4.2 to 86c9363

CLOUDSTACK-4713: EIP/ELB Basic Zone: UI > Network > IP Addresses > make extra API call to get IPs allocated at guest network.


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

Branch: refs/heads/4.2
Commit: 0bdbb9e72f8590f7cd5384a9ed227e99374f90f8
Parents: 24e898b
Author: Jessica Wang <je...@apache.org>
Authored: Thu Sep 19 18:34:42 2013 -0700
Committer: Jessica Wang <je...@apache.org>
Committed: Thu Sep 19 18:34:42 2013 -0700

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0bdbb9e7/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index 9d4cf38..421582a 100755
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -2054,57 +2054,63 @@
                     },
 
                     dataProvider: function(args) {
-                        var data = {};
-                        listViewDataProvider(args, data);
-
-                        //The following 10 lines caused CLOUDSTACK-4713 (EIP/ELB Basic Zone - unable to see any IPs that are acquired)
-                        /*
-                        if (g_supportELB == "guest") // IPs are allocated on guest network
-                            $.extend(data, {
-                                forvirtualnetwork: false,
-                                forloadbalancing: true
-                            });
-                        else if (g_supportELB == "public") // IPs are allocated on public network
-                            $.extend(data, {
-                                forvirtualnetwork: true,
-                                forloadbalancing: true
-                            });
-                        */
-
+                    	var items = [];                    	
+                    	var data = {};
+                        listViewDataProvider(args, data);     
                         if (args.context.networks) {
                             $.extend(data, {
                                 associatedNetworkId: args.context.networks[0].id
                             });
-
                         }
-
                         if ("vpc" in args.context) {
                             $.extend(data, {
                                 vpcid: args.context.vpc[0].id
                             });
-                        }
-
+                        }  
+                        
                         $.ajax({
                             url: createURL('listPublicIpAddresses'),
-                            data: data,
+                            data: $.extend({}, data, {
+                                forvirtualnetwork: true, //IPs are allocated on public network
+                            }),
                             dataType: "json",
-                            async: true,
+                            async: false,
                             success: function(json) {
-                                var items = json.listpublicipaddressesresponse.publicipaddress;
-
-                                $(items).each(function() {
-                                    getExtaPropertiesForIpObj(this, args);
-                                });
-
-                                args.response.success({
-                                    actionFilter: actionFilters.ipAddress,
-                                    data: items
-                                });
-                            },
-                            error: function(data) {
-                                args.response.error(parseXMLHttpResponse(data));
+                                var ips = json.listpublicipaddressesresponse.publicipaddress;                                
+                                if(ips != null) {
+                                	for(var i = 0; i < ips.length; i++) {                                		
+                                		getExtaPropertiesForIpObj(ips[i], args);
+                                		items.push(ips[i]);                                		
+                                	}
+                                }                                
                             }
                         });
+                                                
+                        if (g_supportELB == "guest") {                  
+	                        $.ajax({
+	                            url: createURL('listPublicIpAddresses'),
+	                            data: $.extend({}, data, {
+	                                forvirtualnetwork: false, // ELB IPs are allocated on guest network       
+	                                forloadbalancing: true
+	                            }),
+	                            dataType: "json",
+	                            async: false,
+	                            success: function(json) {
+	                                var ips = json.listpublicipaddressesresponse.publicipaddress;	                                
+	                                if(ips != null) {
+	                                	for(var i = 0; i < ips.length; i++) {	                                		
+	                                		getExtaPropertiesForIpObj(ips[i], args);
+	                                		items.push(ips[i]);                                		
+	                                	}
+	                                }                                
+	                            }
+	                        });
+                        }
+                         
+                        args.response.success({
+                            actionFilter: actionFilters.ipAddress,
+                            data: items
+                        });                        
                     },
 
                     // Detail view