add node field for add new instance
Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
parent
3116a47416
commit
00b1bb310d
@ -271,7 +271,7 @@ async function handleDiskResize () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function handleDiskMove () {
|
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 storage = await requestPVE(`/nodes/${node}/storage`, "GET", null);
|
||||||
let dialog = document.createElement("dialog-form");
|
let dialog = document.createElement("dialog-form");
|
||||||
document.body.append(dialog);
|
document.body.append(dialog);
|
||||||
@ -352,7 +352,7 @@ async function handleDiskDelete () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function handleDiskAdd () {
|
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 storage = await requestPVE(`/nodes/${node}/storage`, "GET", null);
|
||||||
let dialog = document.createElement("dialog-form");
|
let dialog = document.createElement("dialog-form");
|
||||||
document.body.append(dialog);
|
document.body.append(dialog);
|
||||||
|
@ -64,27 +64,29 @@ async function handleInstanceAdd () {
|
|||||||
<option value="lxc">Container</option>
|
<option value="lxc">Container</option>
|
||||||
<option value="qemu">Virtual Machine</option>
|
<option value="qemu">Virtual Machine</option>
|
||||||
</select>
|
</select>
|
||||||
|
<label for="node">Node</label>
|
||||||
|
<select name="node" id="node" required></select>
|
||||||
<label for="name">Name</label>
|
<label for="name">Name</label>
|
||||||
<input name="name" id="name" required></input>
|
<input name="name" id="name" required></input>
|
||||||
<label for="vmid">ID</label>
|
<label for="vmid">ID</label>
|
||||||
<input name="vmid" id="vmid" type="number" required></input>
|
<input name="vmid" id="vmid" type="number" required></input>
|
||||||
<label for="cpu">Cores</label>
|
<label for="cpu">Cores (Threads)</label>
|
||||||
<input name="cpu" id="cpu" type="number" min="1" max="8192" required></input>
|
<input name="cpu" id="cpu" type="number" min="1" max="8192" required></input>
|
||||||
<label for="ram">Memory</label>
|
<label for="ram">Memory (MiB)</label>
|
||||||
<input name="ram" id="ram" type="number" min="16", step="1" required></input>
|
<input name="ram" id="ram" type="number" min="16", step="1" required></input>
|
||||||
<fieldset class="none" id="container-specific" style="grid-column: 1 / span 2; margin-top: 10px;">
|
<fieldset class="none" id="container-specific" style="grid-column: 1 / span 2; margin-top: 10px;">
|
||||||
<legend>Container Options</legend>
|
<legend>Container Options</legend>
|
||||||
<div class="input-grid" style="grid-template-columns: auto 1fr;">
|
<div class="input-grid" style="grid-template-columns: auto 1fr;">
|
||||||
<label for="swap">Swap</label>
|
<label for="swap">Swap (MiB)</label>
|
||||||
<input name="swap" id="swap" type="number" min="0" step="1" required disabled></input>
|
<input name="swap" id="swap" type="number" min="0" step="1" required disabled></input>
|
||||||
<label for="template-storage">Template Storage</label>
|
<label for="template-storage">Template Storage</label>
|
||||||
<select name="template-storage" id="template-storage" required disabled></select>
|
<select name="template-storage" id="template-storage" required disabled></select>
|
||||||
<label for="template-storage">Template Image</label>
|
<label for="template-image">Template Image</label>
|
||||||
<select name="template-image" id="template-image" required disabled></select>
|
<select name="template-image" id="template-image" required disabled></select>
|
||||||
<label for="template-storage">ROOTFS Storage</label>
|
<label for="rootfs-storage">ROOTFS Storage</label>
|
||||||
<select name="rootfs-storage" id="rootfs-storage" required disabled></select>
|
<select name="rootfs-storage" id="rootfs-storage" required disabled></select>
|
||||||
<label for="template-size">ROOTFS Size (GiB)</label>
|
<label for="rootfs-size">ROOTFS Size (GiB)</label>
|
||||||
<input name="template-size" id="template-size" type="number" min="0" max="131072" required disabled></input>
|
<input name="rootfs-size" id="rootfs-size" type="number" min="0" max="131072" required disabled></input>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
`;
|
`;
|
||||||
@ -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");
|
let vmidInput = dialog.shadowRoot.querySelector("#vmid");
|
||||||
//vmidInput.min = 200;
|
//vmidInput.min = 200;
|
||||||
//vmidInput.max = 299;
|
//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) => {
|
dialog.callback = async (result, form) => {
|
||||||
if (result === "confirm") {
|
if (result === "confirm") {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user