change vars export naming

Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
Arthur Lu 2023-01-27 21:49:50 +00:00
parent c6ff9c8cfa
commit d6a37ef59c
3 changed files with 15 additions and 23 deletions

View File

@ -8,6 +8,8 @@ class Instance extends HTMLElement {
let shadowRoot = this.attachShadow({mode: "open"});
shadowRoot.innerHTML = `
<link rel="stylesheet" href="css/style.css" type="text/css">
<link rel="stylesheet" href="css/instance.css" type="text/css">
<article>
<div>
<div>
@ -28,18 +30,6 @@ class Instance extends HTMLElement {
</article>
`;
let styleLink = document.createElement("link");
styleLink.rel = "stylesheet";
styleLink.href = "css/style.css";
styleLink.type = "text/css";
shadowRoot.append(styleLink);
let instanceLink = document.createElement("link");
instanceLink.rel = "stylesheet";
instanceLink.href = "css/instance.css";
instanceLink.type = "text/css";
shadowRoot.append(instanceLink);
this.shadowElement = shadowRoot;
this.actionLock = false;
}
@ -81,11 +71,7 @@ class Instance extends HTMLElement {
let configButton = this.shadowElement.querySelector("#configure-btn");
configButton.src = instances[this.status].configButtonSrc;
configButton.alt = instances[this.status].configButtonAlt;
configButton.addEventListener("click", () => {
if (!this.actionLock && this.status !== "running") {
goToPage("config.html", {node: this.node.name, type: this.type, vmid: this.vmid});
}
});
configButton.addEventListener("click", this.handleConfigButton.bind(this));
if (this.node.status !== "online") {
powerButton.classList.add("hidden");
@ -131,12 +117,18 @@ class Instance extends HTMLElement {
this.actionLock = false;
return;
}
else{
else{ // task has not stopped
await waitFor(1000);
}
}
}
}
handleConfigButton () {
if (!this.actionLock && this.status === "stopped") { // if the action lock is false, and the node is stopped, then navigate to the conig page with the node infor in the search query
goToPage("config.html", {node: this.node.name, type: this.type, vmid: this.vmid});
}
}
}
customElements.define("instance-article", Instance);

View File

@ -1,4 +1,4 @@
import {pveAPI, paasAPI} from "/vars.js";
import {PVE, API} from "/vars.js";
export class ResponseError extends Error {
constructor(message) {
@ -98,7 +98,7 @@ export async function requestPVE (path, method, body = null) {
content.headers.CSRFPreventionToken = getCookie("CSRFPreventionToken");
}
let response = await request(`${pveAPI}${path}`, content);
let response = await request(`${PVE}${path}`, content);
return response;
}
@ -117,7 +117,7 @@ export async function requestAPI (path, method, body = null) {
content.headers.CSRFPreventionToken = getCookie("CSRFPreventionToken");
}
let response = await request(`${paasAPI}${path}`, content);
let response = await request(`${API}${path}`, content);
return response;
}

View File

@ -1,2 +1,2 @@
export const pveAPI = "";
export const paasAPI = ""
export const PVE = ""; // the proxmox web api
export const API = ""; // the proxmox-aas api