improve account style,

add allowed nodes to account page,
reduce use of innerHTML

Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
Arthur Lu 2023-05-03 21:06:27 +00:00
parent 35d35af59a
commit 8edca1eed0
3 changed files with 25 additions and 23 deletions

View File

@ -27,24 +27,25 @@
<section class="w3-container">
<h2>Account</h2>
<div class="w3-card w3-padding">
<div class="flex row wrap">
<p id="username">Username: </p>
<p id="pool">Pool: </p>
<p id="vmid">VMID Range: </p>
</div>
<div class="">
<table id="resource-table" class="w3-table w3-table-all" style="overflow-x: auto;">
<thead>
<tr class="w3-black">
<th>Resource</th>
<th>Used</th>
<th>Free</th>
<th>Total</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
<h3>Account Details</h3>
<p id="username">Username:</p>
<p id="pool">Pool:</p>
<p id="vmid">VMID Range:</p>
<p id="nodes">Nodes:</p>
</div>
<div class="w3-card w3-padding w3-margin-top">
<h3>Cluster Resources</h3>
<table id="resource-table" class="w3-table w3-table-all" style="overflow-x: auto;">
<thead>
<tr class="w3-black">
<th>Resource</th>
<th>Used</th>
<th>Free</th>
<th>Total</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</section>
</main>

View File

@ -19,9 +19,10 @@ async function init () {
let user = await requestAPI("/user");
let resources = user.resources;
let instances = user.instances;
document.querySelector("#username").innerHTML += getCookie("username");
document.querySelector("#pool").innerHTML += instances.pool;
document.querySelector("#vmid").innerHTML += `[${instances.vmid.min},${instances.vmid.max}]`;
document.querySelector("#username").innerText = `Username: ${getCookie("username")}`;
document.querySelector("#pool").innerText = `Pool: ${instances.pool}`;
document.querySelector("#vmid").innerText = `VMID Range: ${instances.vmid.min} - ${instances.vmid.max}`;
document.querySelector("#nodes").innerText = `Nodes: ${user.nodes.toString()}`;
buildResourceTable(resources, "#resource-table");
}

View File

@ -53,7 +53,7 @@ function addResourceLine (fieldset, iconHref, labelText, inputAttr, unitText=nul
field.append(icon);
let label = document.createElement("label");
label.innerHTML = labelText;
label.innerText = labelText;
label.htmlFor = labelText;
field.append(label);
@ -120,7 +120,7 @@ function addDiskLine (fieldset, busPrefix, busName, device, diskDetails) {
// Add a label for the disk bus and device number
let diskLabel = document.createElement("label");
diskLabel.innerHTML = diskName;
diskLabel.innerText = diskName;
diskLabel.dataset.disk = diskID;
field.append(diskLabel);