You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by pr...@apache.org on 2013/05/28 09:59:09 UTC
[24/50] git commit: updated refs/heads/master to b03e419
Add internal LB count to VPC chart
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/4ce76429
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/4ce76429
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/4ce76429
Branch: refs/heads/master
Commit: 4ce76429e28a1e1da6ca14d79082da1f1cf0a74f
Parents: d019359
Author: Brian Federle <bf...@gmail.com>
Authored: Tue May 21 16:16:27 2013 -0700
Committer: Brian Federle <bf...@gmail.com>
Committed: Tue May 21 16:16:27 2013 -0700
----------------------------------------------------------------------
ui/scripts/vpc.js | 139 +++++++++++++++++++++++++++++------------------
1 files changed, 86 insertions(+), 53 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4ce76429/ui/scripts/vpc.js
----------------------------------------------------------------------
diff --git a/ui/scripts/vpc.js b/ui/scripts/vpc.js
index 23e7b0c..f96d552 100644
--- a/ui/scripts/vpc.js
+++ b/ui/scripts/vpc.js
@@ -3084,72 +3084,105 @@
async: true,
success: function(json) {
var networks = json.listnetworksresponse.network;
- if(networks != null && networks.length > 0) {
- for(var i = 0; i < networks.length; i++) {
- $.ajax({
- url: createURL("listVirtualMachines"),
- dataType: "json",
- data: {
- networkid: networks[i].id,
- listAll: true
- },
- async: false,
- success: function(json) {
- networks[i].virtualMachines = json.listvirtualmachinesresponse.virtualmachine;
- }
- });
+ var loadBalancers;
+ var error = false;
+
+ // Get load balancers
+ $.ajax({
+ url: createURL('listLoadBalancers'),
+ data: { details: 'min', vpcid: args.context.vpc[0].id },
+ success: function(json) {
+ loadBalancers = json.listloadbalancerssresponse.loadbalancer ?
+ json.listloadbalancerssresponse.loadbalancer : []
+ },
+ error: function(json) {
+ error = true;
}
- }
- args.response.success({
- routerDashboard: [
- {
- id: 'privateGateways',
- name: 'Private gateways',
- total: 0
- },
- {
- id: 'publicIPs',
- name: 'Public IP addresses',
- total: 0
- },
- {
- id: 'siteToSiteVPNs',
- name: 'Site-to-site VPNs',
- total: 0
- },
- {
- id: 'networkACLLists',
- name: 'Network ACL lists',
- total: 0
+ });
+
+ var dataTimer = setInterval(function() {
+ console.log('timer');
+
+ var complete = loadBalancers;
+
+ if (complete) {
+ clearInterval(dataTimer);
+
+ if(networks != null && networks.length > 0) {
+ for(var i = 0; i < networks.length; i++) {
+ $.ajax({
+ url: createURL("listVirtualMachines"),
+ dataType: "json",
+ data: {
+ networkid: networks[i].id,
+ listAll: true
+ },
+ async: false,
+ success: function(json) {
+ networks[i].virtualMachines = json.listvirtualmachinesresponse.virtualmachine;
+ }
+ });
+ }
}
- ],
- tiers: $(networks).map(function(index, tier) {
- return $.extend(tier, {
- _dashboardItems: [
+ args.response.success({
+ routerDashboard: [
{
- id: 'tierLoadBalancers',
- name: 'Load balancers',
- totalMultiLine: '0 Internal<br/>0 Public'
+ id: 'privateGateways',
+ name: 'Private gateways',
+ total: 0
},
{
- id: 'tierPortForwarders',
- name: 'Port forwarders',
+ id: 'publicIPs',
+ name: 'Public IP addresses',
total: 0
},
{
- id: 'tierStaticNATs',
- name: 'Static NATs',
+ id: 'siteToSiteVPNs',
+ name: 'Site-to-site VPNs',
total: 0
},
{
- id: 'tierVMs',
- name: 'Virtual Machines',
- total: $.isArray(tier.virtualMachines) ? tier.virtualMachines.length : 0
+ id: 'networkACLLists',
+ name: 'Network ACL lists',
+ total: 0
}
- ]
+ ],
+ tiers: $(networks).map(function(index, tier) {
+ var internalLoadBalancers = $.grep(loadBalancers, function(lb) {
+ return lb.networkid == tier.id;
+ });
+
+ return $.extend(tier, {
+ _dashboardItems: [
+ {
+ id: 'tierLoadBalancers',
+ name: 'Load balancers',
+ totalMultiLine: internalLoadBalancers.length + ' Internal<br/>0 Public'
+ },
+ {
+ id: 'tierPortForwarders',
+ name: 'Port forwarders',
+ total: 0
+ },
+ {
+ id: 'tierStaticNATs',
+ name: 'Static NATs',
+ total: 0
+ },
+ {
+ id: 'tierVMs',
+ name: 'Virtual Machines',
+ total: $.isArray(tier.virtualMachines) ? tier.virtualMachines.length : 0
+ }
+ ]
+ });
+ })
});
- })
- });
+ } else if (error) {
+ clearInterval(dataTimer);
+ cloudStack.dialog.notice({ message: 'Error loading dashboard data.' });
+ }
+ }, 500);
}
});
}