add icons to config form
This commit is contained in:
parent
54fa98e754
commit
ffd48cafad
@ -13,11 +13,11 @@
|
||||
<form>
|
||||
<fieldset>
|
||||
<legend>Name</legend>
|
||||
<div class="label-input" id="name"></div>
|
||||
<div class="input-grid" id="name" style="grid-template-columns: repeat(2, auto);"></div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>Resources</legend>
|
||||
<div class="label-input-unit" id="resources"></div>
|
||||
<div class="input-grid" id="resources" style="grid-template-columns: repeat(4, auto);"></div>
|
||||
</fieldset>
|
||||
<fieldset class="fieldset-no-border">
|
||||
<div class="btn-group" id="form-actions">
|
||||
|
10
css/form.css
10
css/form.css
@ -30,19 +30,11 @@ button {
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
.label-input {
|
||||
.input-grid {
|
||||
display: grid;
|
||||
grid-template-columns: auto auto;
|
||||
column-gap: 10px;
|
||||
}
|
||||
|
||||
.label-input-unit {
|
||||
display: grid;
|
||||
grid-template-columns: auto auto auto;
|
||||
column-gap: 10px;
|
||||
}
|
||||
|
||||
|
||||
legend {
|
||||
top: -0.6em;
|
||||
position: relative;
|
||||
|
@ -13,7 +13,7 @@
|
||||
<form>
|
||||
<fieldset>
|
||||
<legend>Proxmox VE Login</legend>
|
||||
<div class="label-input">
|
||||
<div class="input-grid" style="grid-template-columns: repeat(2, auto);">
|
||||
<label for="username">Username</label>
|
||||
<input type="text" id="username" name="username">
|
||||
<label for="username">Password</label>
|
||||
|
@ -26,10 +26,10 @@ async function populateForm (node, type, vmid) {
|
||||
|
||||
let name = type === "qemu" ? "name" : "hostname";
|
||||
addFormLine("name", "Name", {type: "text", value: config.data[name]});
|
||||
addFormLine("resources", "Cores", {type: "number", value: config.data.cores, min: 1, max: 8192}, "Threads");
|
||||
addFormLine("resources", "Memory", {type: "number", value: config.data.memory / 1024, min: 0, step: 0.001}, "GiB");
|
||||
addFormLine("resources", "images/resources/cpu.svg", "Cores", {type: "number", value: config.data.cores, min: 1, max: 8192}, "Threads");
|
||||
addFormLine("resources", "images/resources/ram.svg", "Memory", {type: "number", value: config.data.memory / 1024, min: 0, step: 0.001}, "GiB");
|
||||
if (type === "lxc") {
|
||||
addFormLine("resources", "Swap", {type: "number", value: config.data.swap / 1024, min: 0, step: 0.001}, "GiB");
|
||||
addFormLine("resources", "images/resources/swap.svg", "Swap", {type: "number", value: config.data.swap / 1024, min: 0, step: 0.001}, "GiB");
|
||||
}
|
||||
|
||||
if (type === "qemu") {
|
||||
@ -40,7 +40,7 @@ async function populateForm (node, type, vmid) {
|
||||
sata = JSON.parse(sata);
|
||||
let sizeNum = +(sata.size.replaceAll("G", "").replaceAll("M", ""));
|
||||
let sizeUnit = sata.size.includes("G") ? "GiB" : "MiB";
|
||||
addFormLine("resources", `SATA ${i}`, {type: "number", value: sizeUnit === "GiB" ? sizeNum.toFixed(3) : (sizeNum / 1024).toFixed(3), min: 0, step: 0.001}, "GiB");
|
||||
addFormLine("resources", "images/resources/disk.svg", `SATA ${i}`, {type: "number", value: sizeUnit === "GiB" ? sizeNum.toFixed(3) : (sizeNum / 1024).toFixed(3), min: 0, step: 0.001}, "GiB");
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@ -50,13 +50,17 @@ async function populateForm (node, type, vmid) {
|
||||
rootfs = JSON.parse(rootfs);
|
||||
let sizeNum = +(rootfs.size.replaceAll("G", "").replaceAll("M", ""));
|
||||
let sizeUnit = rootfs.size.includes("G") ? "GiB" : "MiB";
|
||||
addFormLine("resources", "Root FS", {type: "number", value: sizeUnit === "GiB" ? sizeNum.toFixed(3) : (sizeNum / 1024).toFixed(3), min: 0, step: 0.001}, "GiB");
|
||||
addFormLine("resources", "images/resources/disk.svg", "Root FS", {type: "number", value: sizeUnit === "GiB" ? sizeNum.toFixed(3) : (sizeNum / 1024).toFixed(3), min: 0, step: 0.001}, "GiB");
|
||||
}
|
||||
}
|
||||
|
||||
function addFormLine (fieldset, labelText, inputAttr, unitText=null) {
|
||||
function addFormLine (fieldset, iconHref, labelText, inputAttr, unitText=null) {
|
||||
let field = document.querySelector(`#${fieldset}`);
|
||||
|
||||
let icon = document.createElement("img");
|
||||
icon.src = iconHref;
|
||||
field.append(icon);
|
||||
|
||||
let label = document.createElement("label");
|
||||
label.innerHTML = labelText;
|
||||
field.append(label);
|
||||
|
Loading…
Reference in New Issue
Block a user