From ae499383035cecccee53b1c15caa9d57ec412703 Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Thu, 2 Feb 2023 19:35:14 +0000 Subject: [PATCH] implement disk move delete source Signed-off-by: Arthur Lu --- scripts/config.js | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/scripts/config.js b/scripts/config.js index 75fc164..0a4568f 100644 --- a/scripts/config.js +++ b/scripts/config.js @@ -244,10 +244,10 @@ async function handleDiskMove () { dialog.header = `Move ${this.id}`; - let label = document.createElement("label"); - label.for = "storage-select"; - label.innerText = "Storage"; - dialog.append(label); + let storageLabel = document.createElement("label"); + storageLabel.for = "storage-select"; + storageLabel.innerText = "Storage"; + dialog.append(storageLabel); let storageSelect = document.createElement("select"); storageSelect.name = "storage-select"; @@ -259,13 +259,24 @@ async function handleDiskMove () { dialog.append(storageSelect); + let deleteLabel = document.createElement("label"); + deleteLabel.for = "delete-check"; + deleteLabel.innerText = "Delete Source"; + dialog.append(deleteLabel); + + let deleteCheckbox = document.createElement("input"); + deleteCheckbox.type = "checkbox"; + deleteCheckbox.name = "delete-check" + deleteCheckbox.checked = true; + dialog.append(deleteCheckbox); + dialog.callback = async (result, form) => { if(result === "confirm") { let body = { node: node, type: type, vmid: vmid, - action: JSON.stringify({storage: storageSelect.value, disk: this.id}) + action: JSON.stringify({storage: storageSelect.value, disk: this.id, delete: deleteCheckbox.checked ? "1": "0"}) } let result = await requestAPI("/disk/move", "POST", body); if (result.status === 200) {