From 300f55c38f863df451e951a41ae3c0e9006afa99 Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Thu, 23 Feb 2023 22:14:06 +0000 Subject: [PATCH] add node field for add new instance Signed-off-by: Arthur Lu --- scripts/config.js | 4 ++-- scripts/index.js | 34 +++++++++++++++++++++++++--------- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/scripts/config.js b/scripts/config.js index d1b5223..e643ef5 100644 --- a/scripts/config.js +++ b/scripts/config.js @@ -271,7 +271,7 @@ async function handleDiskResize () { } async function handleDiskMove () { - let content = type === "qemu" ? "images" : "rootdir" + 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); @@ -352,7 +352,7 @@ async function handleDiskDelete () { } async function handleDiskAdd () { - let content = type === "qemu" ? "images" : "rootdir" + 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); diff --git a/scripts/index.js b/scripts/index.js index 2e6449a..4315c41 100644 --- a/scripts/index.js +++ b/scripts/index.js @@ -64,27 +64,29 @@ async function handleInstanceAdd () { + + - + - +
Container Options
- - + + - + - - - - + + + +
`; @@ -104,10 +106,24 @@ async function handleInstanceAdd () { } }); + let nodeSelect = dialog.shadowRoot.querySelector("#node"); + nodeSelect.selectedIndex = -1; + // populate nodeSelect + nodeSelect.addEventListener("change", async () => { // change template and rootfs storage based on node + }); + let vmidInput = dialog.shadowRoot.querySelector("#vmid"); //vmidInput.min = 200; //vmidInput.max = 299; + let templateContent = "iso"; + let templateStorage = dialog.shadowRoot.querySelector("#template-storage"); + let templateImage = dialog.shadowRoot.querySelector("#template-image"); + + let rootfsContent = "rootdir"; + let rootfsStorage = dialog.shadowRoot.querySelector("#rootfs-storage"); + let rootfsSize = dialog.shadowRoot.querySelector("#rootfs-size"); + dialog.callback = async (result, form) => { if (result === "confirm") {