diff --git a/images/actions/drag.svg b/images/actions/drag.svg new file mode 100644 index 0000000..92e2077 --- /dev/null +++ b/images/actions/drag.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/scripts/config.js b/scripts/config.js index 34ad17e..be9a26a 100644 --- a/scripts/config.js +++ b/scripts/config.js @@ -732,14 +732,14 @@ async function populateBoot () { for (let i = 0; i < order.length; i++) { const element = order[i]; const prefix = eligible.find((pref) => order[i].startsWith(pref)); - const value = config.data[element]; - bootable[i] = { id: element, prefix, value }; + const detail = config.data[element]; + bootable[i] = { id: element, prefix, detail }; } Object.keys(config.data).forEach((element) => { const prefix = eligible.find((pref) => element.startsWith(pref)); - const value = config.data[element]; + const detail = config.data[element]; if (prefix && !order.includes(element)) { - bootable.disabled.push({ id: element, prefix, value }); + bootable.disabled.push({ id: element, prefix, detail }); } }); Object.keys(bootable).sort(); @@ -760,9 +760,10 @@ function addBootLine (container, data, before = null) { const item = document.createElement("draggable-item"); item.data = data; item.innerHTML = ` +
${data.id}
- + `; item.draggable = true; item.classList.add("drop-target"); @@ -774,6 +775,7 @@ function addBootLine (container, data, before = null) { document.querySelector(`#${container}`).append(item); } item.container = container; + item.value = data.id; bootEntries[item.id] = item; } @@ -805,6 +807,7 @@ async function handleFormExit () { } else if (type === "qemu") { body.proctype = document.querySelector("#proctype").value; + body.boot = document.querySelector("#enabled").value; } const result = await requestAPI(`/cluster/${node}/${type}/${vmid}/resources`, "POST", body); if (result.status === 200) { diff --git a/scripts/draggable.js b/scripts/draggable.js index 1a4295c..ebebd9c 100644 --- a/scripts/draggable.js +++ b/scripts/draggable.js @@ -39,6 +39,18 @@ class DraggableContainer extends HTMLElement { return false; } } + + set value (value) {} + + get value () { + const value = []; + this.content.childNodes.forEach((element) => { + if (element.value) { + value.push(element.value); + } + }); + return value; + } } class DraggableItem extends HTMLElement { @@ -49,11 +61,14 @@ class DraggableItem extends HTMLElement { this.shadowRoot.innerHTML = `