From 9e070e41b905824877372275f2fedc28cbd5fd71 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Tue, 8 Nov 2011 11:56:23 -0800 Subject: [PATCH] cloudStack 3.0 new UI - domain page - add Instance Total field, Volume Total field. --- ui/scripts/domains.js | 48 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 9 deletions(-) diff --git a/ui/scripts/domains.js b/ui/scripts/domains.js index a79579ccf57..c6c4c06b771 100644 --- a/ui/scripts/domains.js +++ b/ui/scripts/domains.js @@ -141,8 +141,8 @@ { id: { label: 'ID' }, accountTotal: { label: 'Accounts' }, - instances: { label: 'Instances' }, - volumes: { label: 'Volumes' } + vmTotal: { label: 'Instances' }, + volumeTotal: { label: 'Volumes' } } ], dataProvider: function(args) { @@ -152,16 +152,46 @@ async: false, dataType: "json", success: function(json) { - var accounts = json.listaccountsresponse.account; - var accountTotal; - if (accounts != null) - accountTotal = accounts.length; + var items = json.listaccountsresponse.account; + var total; + if (items != null) + total = items.length; else - accountTotal = 0; - domainObj["accountTotal"] = accountTotal; + total = 0; + domainObj["accountTotal"] = total; } }); - + + $.ajax({ + url: createURL("listVirtualMachines&domainid=" + domainObj.id), + async: false, + dataType: "json", + success: function(json) { + var items = json.listvirtualmachinesresponse.virtualmachine; + var total; + if (items != null) + total = items.length; + else + total = 0; + domainObj["vmTotal"] = total; + } + }); + + $.ajax({ + url: createURL("listVolumes&domainid=" + domainObj.id), + async: false, + dataType: "json", + success: function(json) { + var items = json.listvolumesresponse.volume; + var total; + if (items != null) + total = items.length; + else + total = 0; + domainObj["volumeTotal"] = total; + } + }); + args.response.success({ data: domainObj });