From a23aad9e99cae080fe65e72cf8c836a710e37a17 Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Tue, 18 Apr 2023 23:31:54 +0000 Subject: [PATCH] use new resource return format Signed-off-by: Arthur Lu --- account.html | 3 ++- scripts/account.js | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/account.html b/account.html index d4cc8a0..1fdcd4e 100644 --- a/account.html +++ b/account.html @@ -24,7 +24,8 @@ Resource Type - Avaliable Amount + Allocated Amount + Free Amount Total Amount diff --git a/scripts/account.js b/scripts/account.js index ce88775..402765d 100644 --- a/scripts/account.js +++ b/scripts/account.js @@ -4,7 +4,7 @@ window.addEventListener("DOMContentLoaded", init); async function init () { let resources = await requestAPI("/user/resources"); - buildResourceTable(resources.resources, "#resource-table"); + buildResourceTable(resources, "#resource-table"); } function buildResourceTable (object, tableid) { @@ -17,10 +17,12 @@ function buildResourceTable (object, tableid) { let row = tbody.insertRow(); let key = row.insertCell(); key.innerText = `${element}`; + let used = row.insertCell(); + used.innerText = `${object.used[element]}`; let val = row.insertCell(); - val.innerText = `${object.available[element]}` - let total = row.insertCell();; - total.innerText = `${object.maximum[element]}` + val.innerText = `${object.available[element]}`; + let total = row.insertCell(); + total.innerText = `${object.maximum[element]}`; }); } } \ No newline at end of file