use new resource return format

Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
Arthur Lu 2023-04-18 23:31:54 +00:00
parent 9be45c952f
commit a23aad9e99
2 changed files with 8 additions and 5 deletions

View File

@ -24,7 +24,8 @@
<thead style="background-color: black; color: white;">
<tr style="background-color: black; color: white;">
<th style="background-color: black; color: white;">Resource Type</th>
<th style="background-color: black; color: white;">Avaliable Amount</th>
<th style="background-color: black; color: white;">Allocated Amount</th>
<th style="background-color: black; color: white;">Free Amount</th>
<th style="background-color: black; color: white;">Total Amount</th>
</tr>
</thead>

View File

@ -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]}`;
});
}
}