From 6984f20998ff18e5b864e6142eb8a5634638e325 Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Thu, 12 Jan 2023 15:05:22 -0800 Subject: [PATCH] add storage target option adding --- scripts/config.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/config.js b/scripts/config.js index 4ca7270..25a70ba 100644 --- a/scripts/config.js +++ b/scripts/config.js @@ -4,10 +4,12 @@ window.addEventListener("DOMContentLoaded", init); let diskConfig = { lxc: { + storageContent: "rootdir", prefixOrder: ["mp"], mp: {name: "MP", limit: 255, used: {}} }, qemu: { + storageContent: "images", prefixOrder: ["sata", "ide"], ide: {name: "IDE", limit: 3, used: {}}, sata: {name: "SATA", limit: 5, used: {}} @@ -150,10 +152,13 @@ async function populateAddDisk () { addDiskDevice.addEventListener("input", handleDiskDeviceChange); addDiskDevice.addEventListener("focus", handleDiskDeviceChange); - let storage = await request(`/nodes/${node}/storage`); - console.log(storage) - let addDiskStorage = document.querySelector("#add-disk #storage"); + let storage = await request(`/nodes/${node}/storage`); + storage.data.forEach((element) => { + if (element.content.includes(diskConfig[type].storageContent)) { // check if the storage contains rootdir or images content + addDiskStorage.add(new Option(element.storage)); + } + }); let addDiskSize = document.querySelector("#add-disk #size"); }