code cleanup
Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
parent
d057d98924
commit
cd3027c35e
@ -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");
|
||||
typeSelect.selectedIndex = -1;
|
||||
typeSelect.addEventListener("change", () => {
|
||||
@ -193,4 +186,11 @@ async function handleInstanceAdd () {
|
||||
});
|
||||
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 {alert, dialog} from "./dialog.js";
|
||||
import {PVE} from "../vars.js"
|
||||
|
||||
export class Instance extends HTMLElement {
|
||||
constructor () {
|
||||
@ -168,7 +169,7 @@ export class Instance extends HTMLElement {
|
||||
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: ""};
|
||||
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";
|
||||
|
||||
window.addEventListener("DOMContentLoaded", init);
|
||||
|
@ -197,6 +197,5 @@ export function getURIData () {
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
@ -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