From 819cee081bd0e39d0486b4bb4efc215a075df25e Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Fri, 16 Dec 2011 14:02:55 -0800 Subject: [PATCH] Update test dashboard --- ui/scripts-test/dashboard.js | 69 +++++++++++++++++++++++++++--------- 1 file changed, 52 insertions(+), 17 deletions(-) diff --git a/ui/scripts-test/dashboard.js b/ui/scripts-test/dashboard.js index db7da020c82..cbbbef037dd 100644 --- a/ui/scripts-test/dashboard.js +++ b/ui/scripts-test/dashboard.js @@ -4,23 +4,58 @@ title: 'Dashboard', show: cloudStack.uiCustom.dashboard, - dataProvider: function(args) { - args.response.success({ - data: { - publicIPAllocated: 50, - publicIPTotal: 100, - publicIPPercentage: 50, - privateIPAllocated: 50, - privateIPTotal: 100, - privateIPPercentage: (100 / 50) * 10, - memoryAllocated: 256, - memoryTotal: 1024, - memoryPercentage: (1024 / 256) * 10, - cpuAllocated: 500, - cpuTotal: 1200, - cpuPercentage: (1200 / 500) * 10 - } - }); + adminCheck: function(args) { + return args.context.users[0].role == 'admin'; + }, + + user: { + dataProvider: function(args) { + args.response.success({ + data: { + runningInstances: 10, + stoppedInstances: 2, + totalInstances: 12, + accountID: '12', + accountName: 'brian', + userName: 'brian', + accountType: 'user', + accountDomainID: 12 + } + }) + } + }, + + admin: { + dataProvider: function(args) { + args.response.success({ + data: { + publicIPAllocated: 50, + publicIPTotal: 100, + publicIPPercentage: 50, + privateIPAllocated: 50, + privateIPTotal: 100, + privateIPPercentage: (100 / 50) * 10, + memoryAllocated: 256, + memoryTotal: 1024, + memoryPercentage: (1024 / 256) * 10, + cpuAllocated: 500, + cpuTotal: 1200, + cpuPercentage: (1200 / 500) * 10, + alerts: $.map(testData.data.alerts, function(alert) { + return { + name: 'System Alert', + description: alert.description + }; + }), + hostAlerts: $.map(testData.data.alerts, function(alert) { + return { + name: 'Host Alert', + description: alert.description + }; + }) + } + }); + } } }; })(cloudStack, testData);