remove org specific values,

add dynamic org handling

Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
2023-05-16 15:18:36 +00:00
parent d6a7785ab0
commit d10aeedcf2
10 changed files with 26 additions and 16 deletions

View File

@@ -1,4 +1,4 @@
import {requestAPI, goToPage, getCookie} from "./utils.js";
import {requestAPI, goToPage, getCookie, setTitleAndHeader} from "./utils.js";
window.addEventListener("DOMContentLoaded", init);
@@ -11,6 +11,7 @@ let SIPrefix = [
]
async function init () {
setTitleAndHeader();
let cookie = document.cookie;
if (cookie === "") {
goToPage("login.html");

View File

@@ -1,4 +1,4 @@
import {requestPVE, requestAPI, goToPage, getURIData, resources_config} from "./utils.js";
import {requestPVE, requestAPI, goToPage, getURIData, resources_config, setTitleAndHeader} from "./utils.js";
import {alert, dialog} from "./dialog.js";
window.addEventListener("DOMContentLoaded", init); // do the dumb thing where the disk config refreshes every second
@@ -12,6 +12,7 @@ let vmid;
let config;
async function init () {
setTitleAndHeader();
let cookie = document.cookie;
if (cookie === "") {
goToPage("login.html");

View File

@@ -1,10 +1,11 @@
import {requestPVE, requestAPI, goToPage, goToURL, instances_config, nodes_config} from "./utils.js";
import {requestPVE, requestAPI, goToPage, goToURL, instances_config, nodes_config, setTitleAndHeader} from "./utils.js";
import {alert, dialog} from "./dialog.js";
import {PVE} from "../vars.js"
window.addEventListener("DOMContentLoaded", init);
async function init () {
setTitleAndHeader();
let cookie = document.cookie;
if (cookie === "") {
goToPage("login.html");

View File

@@ -1,9 +1,10 @@
import {requestTicket, goToPage, deleteAllCookies, requestPVE} from "./utils.js";
import {requestTicket, goToPage, deleteAllCookies, requestPVE, setTitleAndHeader} from "./utils.js";
import {alert} from "./dialog.js";
window.addEventListener("DOMContentLoaded", init);
async function init (){
setTitleAndHeader();
await deleteAllCookies();
let formSubmitButton = document.querySelector("#submit");
let realms = await requestPVE("/access/domains", "GET");

View File

@@ -1,4 +1,4 @@
import {API} from "/vars.js";
import {API, organization} from "/vars.js";
export const resources_config = {
disk: {
@@ -164,7 +164,7 @@ export function goToPage (page, data={}, newwindow = false) {
}
if (newwindow) {
window.open(url, "tronnet - client", "height=480,width=848");
window.open(url, `${organization} - client`, "height=480,width=848");
}
else {
window.location.assign(url.toString());
@@ -178,7 +178,7 @@ export function goToURL (href, data={}, newwindow = false) {
}
if (newwindow) {
window.open(url, "tronnet - client", "height=480,width=848");
window.open(url, `${organization} - client`, "height=480,width=848");
}
else {
window.location.assign(url.toString());
@@ -192,4 +192,9 @@ export function getURIData () {
export async function deleteAllCookies () {
await requestAPI("/ticket", "DELETE");
}
export function setTitleAndHeader () {
document.title = `${organization} - client`;
document.querySelector("h1").innerText = organization;
}