implement disk move delete source

Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
Arthur Lu 2023-02-02 19:35:14 +00:00
parent 426313a2ae
commit ae49938303

View File

@ -244,10 +244,10 @@ async function handleDiskMove () {
dialog.header = `Move ${this.id}`; dialog.header = `Move ${this.id}`;
let label = document.createElement("label"); let storageLabel = document.createElement("label");
label.for = "storage-select"; storageLabel.for = "storage-select";
label.innerText = "Storage"; storageLabel.innerText = "Storage";
dialog.append(label); dialog.append(storageLabel);
let storageSelect = document.createElement("select"); let storageSelect = document.createElement("select");
storageSelect.name = "storage-select"; storageSelect.name = "storage-select";
@ -259,13 +259,24 @@ async function handleDiskMove () {
dialog.append(storageSelect); 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) => { dialog.callback = async (result, form) => {
if(result === "confirm") { if(result === "confirm") {
let body = { let body = {
node: node, node: node,
type: type, type: type,
vmid: vmid, 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); let result = await requestAPI("/disk/move", "POST", body);
if (result.status === 200) { if (result.status === 200) {