cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jessicaw...@apache.org
Subject git commit: updated refs/heads/4.4 to 220309c
Date Tue, 08 Apr 2014 18:12:21 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.4 156fb7ebd -> 220309c64


CLOUDSTACK-6342: UI - Load Balancing - LB rule listing - pass lbvmips=true to listLoadBalancerRuleInstances
API and display "VM + IP Address" under each LB rule.


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

Branch: refs/heads/4.4
Commit: 220309c64978c2944552dd39feef9dd86ad1b1d1
Parents: 156fb7e
Author: Jessica Wang <jessicawang@apache.org>
Authored: Tue Apr 8 11:11:57 2014 -0700
Committer: Jessica Wang <jessicawang@apache.org>
Committed: Tue Apr 8 11:12:10 2014 -0700

----------------------------------------------------------------------
 ui/scripts/network.js              | 85 ++++++++++++++++++++-------------
 ui/scripts/ui/widgets/multiEdit.js |  9 ++++
 2 files changed, 61 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/220309c6/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index d0ae2e1..0bf5d91 100755
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -3806,31 +3806,30 @@
                                                 dataType: 'json',
                                                 async: true,
                                                 success: function(data) {
-                                                    var loadBalancerData = data.listloadbalancerrulesresponse.loadbalancerrule;
-                                                    var loadVMTotal = loadBalancerData ?
loadBalancerData.length : 0;
-                                                    var loadVMCurrent = 0;
-
-                                                    $(loadBalancerData).each(function() {
-                                                        loadVMCurrent++;
-                                                        var item = this;
+                                                    var loadbalancerrules = data.listloadbalancerrulesresponse.loadbalancerrule;
                                                   
+                                                    
+                                                    $(loadbalancerrules).each(function()
{                                                        
+                                                        var lbRule = this;
                                                         var stickyData = {};
-                                                        var lbInstances = [];
+                                                        
+                                                        //var lbInstances = [];
+                                                        var itemData = [];
 
                                                         // Passing _hideFields array will
disable specified fields for this row
-                                                        //item._hideFields = ['autoScale'];
+                                                        //lbRule._hideFields = ['autoScale'];
 
                                                         $.ajax({
                                                             url: createURL('listAutoScaleVmGroups'),
                                                             data: {
                                                                 listAll: true,
-                                                                lbruleid: item.id
+                                                                lbruleid: lbRule.id
                                                             },
                                                             async: false,
                                                             success: function(json) {
                                                                 if (json.listautoscalevmgroupsresponse.autoscalevmgroup
!= null && json.listautoscalevmgroupsresponse.autoscalevmgroup.length > 0) { //from
'autoScale' button
-                                                                    item._hideFields = ['add-vm'];
+                                                                    lbRule._hideFields =
['add-vm'];
                                                                 } else { //from 'add-vm'
button
-                                                                    item._hideFields = ['autoScale'];
+                                                                    lbRule._hideFields =
['autoScale'];
                                                                 }
                                                             }
                                                         });
@@ -3841,7 +3840,7 @@
                                                             async: false,
                                                             data: {
                                                                 listAll: true,
-                                                                lbruleid: item.id
+                                                                lbruleid: lbRule.id
                                                             },
                                                             success: function(json) {
                                                                 var stickyPolicy = json.listlbstickinesspoliciesresponse.stickinesspolicies
?
@@ -3857,12 +3856,12 @@
                                                                         methodname: stickyPolicy.methodname,
                                                                         stickyName: stickyPolicy.name,
                                                                         id: stickyPolicy.id,
-                                                                        lbRuleID: item.id
+                                                                        lbRuleID: lbRule.id
                                                                     };
                                                                     $.extend(stickyData,
stickyPolicy.params);
                                                                 } else {
                                                                     stickyData = {
-                                                                        lbRuleID: item.id
+                                                                        lbRuleID: lbRule.id
                                                                     };
                                                                 }
                                                             },
@@ -3880,42 +3879,62 @@
                                                             async: false,
                                                             data: {
                                                                 listAll: true,
-                                                                id: item.id
+                                                                lbvmips: true,
+                                                                id: lbRule.id           
                                                    
                                                             },
                                                             success: function(data) {
-                                                                lbInstances = data.listloadbalancerruleinstancesresponse.loadbalancerruleinstance
?
-                                                                    data.listloadbalancerruleinstancesresponse.loadbalancerruleinstance
: [];
-
-                                                                $(lbInstances).each(function()
{
-                                                                    if (this.displayname.indexOf('AutoScale-LB-')
> -1) //autoscale VM is not allowed to be deleted manually. So, hide destroy button
-                                                                        this._hideActions
= ['destroy'];
-
-                                                                    if (this.servicestate)
{
-                                                                        this._itemStateLabel
= 'label.service.state';
-                                                                        this._itemState =
this.servicestate;
-                                                                    }
-                                                                });
+                                                            	//when "lbvmips: true" is not
passed to API
+                                                                //lbVMs = data.listloadbalancerruleinstancesresponse.loadbalancerruleinstance;

+                                                            	
+                                                            	//when "lbvmips: true" is passed
to API
+                                                            	lbrulevmidips = data.listloadbalancerruleinstancesresponse.lbrulevmidip;

+                                                                             
+                                                                if (lbrulevmidips != null)
{
+                                                                	for (var k = 0; k < lbrulevmidips.length;
k++) {
+                                                                		var lbrulevmidip = lbrulevmidips[k];
+                                                                		var lbVM = lbrulevmidip.loadbalancerruleinstance;
                                                               	
+                                                                        if (lbVM.displayname.indexOf('AutoScale-LB-')
> -1) //autoscale VM is not allowed to be deleted manually. So, hide destroy button
+                                                                            lbVM._hideActions
= ['destroy'];
+
+                                                                        if (lbVM.servicestate)
{
+                                                                            lbVM._itemStateLabel
= 'label.service.state';
+                                                                            lbVM._itemState
= lbVM.servicestate;
+                                                                        }
+                                                                                        
                                                      
+                                                                        if (lbrulevmidip.lbvmipaddresses
!= null) {
+                                                                        	for (var m = 0 ;
m < lbrulevmidip.lbvmipaddresses.length; m++) {
+                                                                        		var ip = lbrulevmidip.lbvmipaddresses[m];
+                                                                        		itemData.push($.extend({},
lbVM, {
+                                                                        			itemIp: ip
+                                                                        		}));          
                                                             		
+                                                                        	}
+                                                                        } else {
+                                                                        	itemData.push(lbVM);
+                                                                        }               
                                                        
+                                                                	}
+                                                                }                       
                                        
                                                             },
                                                             error: function(data) {
                                                                 args.response.error(parseXMLHttpResponse(data));
                                                             }
-                                                        });
+                                                        });                             
                          
 
-                                                        $.extend(item, {
+                                                        $.extend(lbRule, {
                                                             _itemName: 'name',
-                                                            _itemData: lbInstances,
+                                                            _itemIp: 'itemIp',
+                                                            _itemData: itemData,
                                                             _maxLength: {
                                                                 name: 7
                                                             },
                                                             sticky: stickyData,
                                                             autoScale: {
-                                                                lbRuleID: item.id
+                                                                lbRuleID: lbRule.id
                                                             }
                                                         });
                                                     });
 
                                                     args.response.success({
-                                                        data: loadBalancerData
+                                                        data: loadbalancerrules
                                                     });
                                                 }
                                             });

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/220309c6/ui/scripts/ui/widgets/multiEdit.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui/widgets/multiEdit.js b/ui/scripts/ui/widgets/multiEdit.js
index 713ebde..367cc27 100755
--- a/ui/scripts/ui/widgets/multiEdit.js
+++ b/ui/scripts/ui/widgets/multiEdit.js
@@ -702,6 +702,7 @@
 
             itemRow: function(item, itemActions, multiRule, $tbody) {
                 var $tr = $('<tr>');
+                
                 var itemName = multiRule._itemName ? item[multiRule._itemName] : item.name;
                 var $itemName = $('<span>').html(_s(itemName));
 
@@ -716,6 +717,14 @@
                     });
                 });
 
+                                
+                var itemIp = multiRule._itemIp ? item[multiRule._itemIp] : null;
+                if (itemIp != null) {
+                	 var $itemIp = $('<span>').html(_s(itemIp));
+                     $tr.append($('<td>').addClass('state').appendTo($tr).append($itemIp));
+                }                        
+                
+                
                 var itemState = item._itemState ? item._itemState : item.state;
 
                 $tr.append($('<td>').addClass('state').appendTo($tr).append(


Mime
View raw message