add options to disk image selection
Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
parent
c0cd6a546e
commit
5ccf122ca6
@ -101,7 +101,7 @@ function addResourceLine (fieldset, iconHref, labelText, inputAttr, unitText=nul
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function addDiskLine (fieldset, busPrefix, busName, device, diskDataParsed, storageOptions) {
|
async function addDiskLine (fieldset, busPrefix, busName, device, diskDataParsed, storageOptions) {
|
||||||
let field = document.querySelector(`#${fieldset}`);
|
let field = document.querySelector(`#${fieldset}`);
|
||||||
|
|
||||||
let icon = document.createElement("img");
|
let icon = document.createElement("img");
|
||||||
@ -139,26 +139,48 @@ function addDiskLine (fieldset, busPrefix, busName, device, diskDataParsed, stor
|
|||||||
storageSelect.id = `${busPrefix}_${device}_storage`;
|
storageSelect.id = `${busPrefix}_${device}_storage`;
|
||||||
field.append(storageSelect);
|
field.append(storageSelect);
|
||||||
|
|
||||||
let size = diskDataParsed.size;
|
if (diskConfig[type][busPrefix].resizable) {
|
||||||
let sizeInput = document.createElement("input");
|
let size = diskDataParsed.size;
|
||||||
sizeInput.type = "number";
|
let sizeInput = document.createElement("input");
|
||||||
sizeInput.min = size;
|
sizeInput.type = "number";
|
||||||
sizeInput.minSize = size;
|
sizeInput.min = size;
|
||||||
sizeInput.max = 131072; // 128 TiB, everything should just use GiB
|
sizeInput.minSize = size;
|
||||||
sizeInput.value = size;
|
sizeInput.max = 131072; // 128 TiB, everything should just use GiB
|
||||||
if (!diskConfig[type][busPrefix].resizable) {
|
sizeInput.value = size;
|
||||||
sizeInput.disabled = true;
|
sizeInput.id = `${busPrefix}_${device}_size`;
|
||||||
sizeInput.classList.add("hidden");
|
field.append(sizeInput);
|
||||||
}
|
|
||||||
sizeInput.id = `${busPrefix}_${device}_size`;
|
|
||||||
field.append(sizeInput);
|
|
||||||
|
|
||||||
let sizeUnit = document.createElement("p");
|
let sizeUnit = document.createElement("p");
|
||||||
sizeUnit.innerText = "GiB";
|
sizeUnit.innerText = "GiB";
|
||||||
if (!diskConfig[type][busPrefix].resizable) {
|
field.append(sizeUnit);
|
||||||
sizeUnit.classList.add("hidden");
|
}
|
||||||
|
else if (diskConfig[type][busPrefix].hasPath) {
|
||||||
|
let pathInput = document.createElement("input");
|
||||||
|
pathInput.value = diskDataParsed.mp;
|
||||||
|
pathInput.id = `${busPrefix}_${device}_path`;
|
||||||
|
field.append(pathInput);
|
||||||
|
|
||||||
|
let blank = document.createElement("div");
|
||||||
|
field.append(blank);
|
||||||
|
}
|
||||||
|
else if (diskConfig[type][busPrefix].hasDiskImage) {
|
||||||
|
let diskImageSelect = document.createElement("select");
|
||||||
|
let diskImageOptions = await request(`/nodes/${node}/storage/${storage}/content?content=iso`);
|
||||||
|
diskImageOptions.data.forEach((element) => {
|
||||||
|
diskImageSelect.add(new Option(element.replace(`${storage}:`), element));
|
||||||
|
});
|
||||||
|
field.append(diskImageSelect);
|
||||||
|
|
||||||
|
let blank = document.createElement("div");
|
||||||
|
field.append(blank);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
let blank1 = document.createElement("div");
|
||||||
|
field.append(blank1);
|
||||||
|
|
||||||
|
let blank2 = document.createElement("div");
|
||||||
|
field.append(blank2);
|
||||||
}
|
}
|
||||||
field.append(sizeUnit);
|
|
||||||
|
|
||||||
let deleteDiv = document.createElement("div");
|
let deleteDiv = document.createElement("div");
|
||||||
deleteDiv.classList.add("last-item");
|
deleteDiv.classList.add("last-item");
|
||||||
@ -200,4 +222,8 @@ function parseDisk (disk) { // disk in format: STORAGE: FILENAME, ARG1=..., ARG2
|
|||||||
}
|
}
|
||||||
|
|
||||||
return parsed;
|
return parsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDiskImageOptions (storage) {
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user