Pass dashboard data via dataProvider
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/bd764cc5 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/bd764cc5 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/bd764cc5 Branch: refs/heads/master Commit: bd764cc581a47e213350ef5749ae523f5b0398c2 Parents: 9e24af7 Author: Brian Federle <bfede...@gmail.com> Authored: Mon May 20 13:55:43 2013 -0700 Committer: Brian Federle <bfede...@gmail.com> Committed: Mon May 20 13:55:50 2013 -0700 ---------------------------------------------------------------------- ui/modules/vpc/vpc.js | 58 ++++++------------------------------------- ui/scripts/vpc.js | 51 +++++++++++++++++++++++++++++++++++++- 2 files changed, 58 insertions(+), 51 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bd764cc5/ui/modules/vpc/vpc.js ---------------------------------------------------------------------- diff --git a/ui/modules/vpc/vpc.js b/ui/modules/vpc/vpc.js index f3cdaf0..3c44a4c 100644 --- a/ui/modules/vpc/vpc.js +++ b/ui/modules/vpc/vpc.js @@ -234,28 +234,7 @@ var $tier = elems.tier({ context: context, tier: tier, - dashboardItems: [ - { - id: 'tierLoadBalancers', - name: 'Load balancers', - totalMultiLine: '5 Internal<br/>6 Public' - }, - { - id: 'tierPortForwarders', - name: 'Port forwarders', - total: 4 - }, - { - id: 'tierStaticNATs', - name: 'Static NATs', - total: 3 - }, - { - id: 'tierVMs', - name: 'Virtual Machines', - total: 300 - } - ] + dashboardItems: tier._dashboardItems }); $tier.appendTo($tiers); @@ -271,37 +250,16 @@ if (args.complete) { args.complete($chart); } + + // Router + $router = elems.router({ + context: context, + dashboardItems: data.routerDashboard + }).appendTo($chart); } - } + } }); - // Router - $router = elems.router({ - context: context, - dashboardItems: [ - { - id: 'privateGateways', - name: 'Private gateways', - total: 1 - }, - { - id: 'publicIPs', - name: 'Public IP addresses', - total: 2 - }, - { - id: 'siteToSiteVPNs', - name: 'Site-to-site VPNs', - total: 3 - }, - { - id: 'networkACLLists', - name: 'Network ACL lists', - total: 2 - } - ] - }).appendTo($chart); - $chart.bind('reload', function() { chart({ complete: function($newChart) { http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bd764cc5/ui/scripts/vpc.js ---------------------------------------------------------------------- diff --git a/ui/scripts/vpc.js b/ui/scripts/vpc.js index ce2334c..a081ab8 100644 --- a/ui/scripts/vpc.js +++ b/ui/scripts/vpc.js @@ -2998,7 +2998,56 @@ }); } } - args.response.success({ tiers: networks }); + 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 + } + ], + tiers: $(networks).map(function(index, tier) { + return $.extend(tier, { + _dashboardItems: [ + { + id: 'tierLoadBalancers', + name: 'Load balancers', + totalMultiLine: '0 Internal<br/>0 Public' + }, + { + id: 'tierPortForwarders', + name: 'Port forwarders', + total: 0 + }, + { + id: 'tierStaticNATs', + name: 'Static NATs', + total: 0 + }, + { + id: 'tierVMs', + name: 'Virtual Machines', + total: 0 + } + ] + }); + }) + }); } }); }