code cleanup
Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
parent
56bf77df96
commit
b5c181b818
@ -125,13 +125,6 @@ async function handleInstanceAdd () {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let userResources = await requestAPI("/user/resources", "GET");
|
|
||||||
let userInstances = await requestAPI("/user/instances", "GET")
|
|
||||||
d.querySelector("#cores").max = userResources.avail.cores;
|
|
||||||
d.querySelector("#memory").max = userResources.avail.memory;
|
|
||||||
d.querySelector("#vmid").min = userInstances.vmid.min;
|
|
||||||
d.querySelector("#vmid").max = userInstances.vmid.max;
|
|
||||||
|
|
||||||
let typeSelect = d.querySelector("#type");
|
let typeSelect = d.querySelector("#type");
|
||||||
typeSelect.selectedIndex = -1;
|
typeSelect.selectedIndex = -1;
|
||||||
typeSelect.addEventListener("change", () => {
|
typeSelect.addEventListener("change", () => {
|
||||||
@ -193,4 +186,11 @@ async function handleInstanceAdd () {
|
|||||||
});
|
});
|
||||||
templateImage.selectedIndex = -1;
|
templateImage.selectedIndex = -1;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let userResources = await requestAPI("/user/resources", "GET");
|
||||||
|
let userInstances = await requestAPI("/user/instances", "GET");
|
||||||
|
d.querySelector("#cores").max = userResources.avail.cores;
|
||||||
|
d.querySelector("#memory").max = userResources.avail.memory;
|
||||||
|
d.querySelector("#vmid").min = userInstances.vmid.min;
|
||||||
|
d.querySelector("#vmid").max = userInstances.vmid.max;
|
||||||
}
|
}
|
@ -1,5 +1,6 @@
|
|||||||
import {requestPVE, requestAPI, goToPage, goToURL, instances, nodes} from "./utils.js";
|
import {requestPVE, requestAPI, goToPage, goToURL, instances, nodes} from "./utils.js";
|
||||||
import {alert, dialog} from "./dialog.js";
|
import {alert, dialog} from "./dialog.js";
|
||||||
|
import {PVE} from "../vars.js"
|
||||||
|
|
||||||
export class Instance extends HTMLElement {
|
export class Instance extends HTMLElement {
|
||||||
constructor () {
|
constructor () {
|
||||||
@ -168,7 +169,7 @@ export class Instance extends HTMLElement {
|
|||||||
if (!this.actionLock && this.status === "running") {
|
if (!this.actionLock && this.status === "running") {
|
||||||
let data = {console: `${this.type === "qemu" ? "kvm" : "lxc"}`, vmid: this.vmid, vmname: this.name, node: this.node.name, resize: "off", cmd: ""};
|
let data = {console: `${this.type === "qemu" ? "kvm" : "lxc"}`, vmid: this.vmid, vmname: this.name, node: this.node.name, resize: "off", cmd: ""};
|
||||||
data[`${this.type === "qemu" ? "novnc" : "xtermjs"}`] = 1;
|
data[`${this.type === "qemu" ? "novnc" : "xtermjs"}`] = 1;
|
||||||
goToURL("https://pve.tronnet.net", data, true);
|
goToURL(PVE, data, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {requestTicket, NetworkError, goToPage, deleteAllCookies, requestPVE} from "./utils.js";
|
import {requestTicket, goToPage, deleteAllCookies, requestPVE} from "./utils.js";
|
||||||
import {alert} from "./dialog.js";
|
import {alert} from "./dialog.js";
|
||||||
|
|
||||||
window.addEventListener("DOMContentLoaded", init);
|
window.addEventListener("DOMContentLoaded", init);
|
||||||
|
@ -197,6 +197,5 @@ export function getURIData () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function deleteAllCookies () {
|
export async function deleteAllCookies () {
|
||||||
document.cookie.split(";").forEach(function(c) { document.cookie = c.replace(/^ +/, "").replace(/=.*/, "=;expires=" + new Date().toUTCString() + ";path=/;domain=.client.tronnet.net;"); });
|
|
||||||
await requestAPI("/ticket", "DELETE");
|
await requestAPI("/ticket", "DELETE");
|
||||||
}
|
}
|
@ -1 +1,2 @@
|
|||||||
export const API = "https://client.mydomain.example/api"; // the proxmox-aas api
|
export const API = "https://client.mydomain.example/api"; // the proxmox-aas api
|
||||||
|
export const PVE = "https://pve.mydomain.example"; // the proxmox api
|
Loading…
Reference in New Issue
Block a user