From 9eb57e17650c67c30cf138d33145d1be98001956 Mon Sep 17 00:00:00 2001 From: Abhinandan Prateek Date: Thu, 19 Nov 2015 15:11:16 +0530 Subject: [PATCH] CLOUDSTACK-8592: account and domain search added in javascript --- ui/plugins/quota/quota.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/ui/plugins/quota/quota.js b/ui/plugins/quota/quota.js index 6b6fd6ff031..d3ff8584b84 100644 --- a/ui/plugins/quota/quota.js +++ b/ui/plugins/quota/quota.js @@ -82,7 +82,7 @@ // FIXME: add logic in mgmt server to filter by account if (args.filterBy.search.value) { console.log(args.filterBy.search.value); - data.account = args.filterBy.search.value; + data.search = args.filterBy.search.value; } $.ajax({ @@ -92,15 +92,18 @@ async: true, success: function(json) { var items = json.quotasummaryresponse.summary; - $.each(items, function(idx, item) { - currency = items[idx].currency; - items[idx].quota = items[idx].currency + ' ' + items[idx].quota; - //items[idx].balance = items[idx].currency + ' ' + items[idx].balance; - items[idx].lowerlimit = -1; - items[idx].upperlimit = 0; - }); + var array=[]; + for (var i = 0; i < items.length; i++) { + if (typeof data.search != 'undefine' && items[i].account.search(data.search) < 0 && items[i].domain.search(data.search) < 0) continue; + currency = items[i].currency; + items[i].quota = currency + ' ' + items[i].quota; + items[i].lowerlimit = -1; + items[i].upperlimit = 0; + array.push(items[i]); + } + args.response.success({ - data: items + data: array }); }, error: function(data) {