From 424f33c8404ab12a1cc56c7f403c8337dbfd802c Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Tue, 14 Feb 2023 21:56:27 +0000 Subject: [PATCH] add create disk dialog form creation Signed-off-by: Arthur Lu --- scripts/config.js | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/scripts/config.js b/scripts/config.js index ad0e158..a59bcae 100644 --- a/scripts/config.js +++ b/scripts/config.js @@ -193,7 +193,7 @@ async function handleDiskAttach () { let diskImage = config.data[this.dataset.disk]; dialog.header = `Attach ${diskImage}`; - dialog.formBody = ``; + dialog.formBody = ``; dialog.callback = async (result, form) => { if (result === "confirm") { @@ -349,7 +349,39 @@ async function handleDiskDelete () { } async function handleDiskAdd () { - + let content = type === "qemu" ? "images" : "rootdir" + let storage = await requestPVE(`/nodes/${node}/storage`, "GET", null); + let dialog = document.createElement("dialog-form"); + document.body.append(dialog); + + let diskImage = config.data[this.dataset.disk]; + + dialog.header = `Create A New Disk`; + dialog.formBody = ` + + + `; + + let storageLabel = document.createElement("label"); + storageLabel.for = "storage-select"; + storageLabel.innerText = "Storage"; + dialog.formBodyAppend(storageLabel); + + let storageSelect = document.createElement("select"); + storageSelect.name = "storage-select"; + storageSelect.id = "storage-select"; + storage.data.forEach((element) => { + if (element.content.includes(content)){ + storageSelect.add(new Option(element.storage)); + } + }); + dialog.formBodyAppend(storageSelect); + + dialog.callback = () => { + + }; + + dialog.show(); } function getOrderedUsed(disks){