remove org specific values,

add dynamic org handling

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

View File

@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>tronnet - client</title> <title>proxmox - client</title>
<link rel="icon" href="images/favicon.svg" sizes="any" type="image/svg+xml"> <link rel="icon" href="images/favicon.svg" sizes="any" type="image/svg+xml">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"> <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="css/style.css"> <link rel="stylesheet" href="css/style.css">
@ -12,7 +12,7 @@
</head> </head>
<body> <body>
<header> <header>
<h1>tronnet</h1> <h1>proxmox</h1>
<label for="navtoggle">&#9776;</label> <label for="navtoggle">&#9776;</label>
<input type="checkbox" id="navtoggle"> <input type="checkbox" id="navtoggle">
<nav> <nav>

View File

@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>tronnet - client</title> <title>proxmox - client</title>
<link rel="icon" href="images/favicon.svg" sizes="any" type="image/svg+xml"> <link rel="icon" href="images/favicon.svg" sizes="any" type="image/svg+xml">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"> <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="css/style.css"> <link rel="stylesheet" href="css/style.css">
@ -13,7 +13,7 @@
</head> </head>
<body> <body>
<header> <header>
<h1>tronnet</h1> <h1>proxmox</h1>
<label for="navtoggle">&#9776;</label> <label for="navtoggle">&#9776;</label>
<input type="checkbox" id="navtoggle"> <input type="checkbox" id="navtoggle">
<nav> <nav>

View File

@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>tronnet - client</title> <title>proxmox - client</title>
<link rel="icon" href="images/favicon.svg" sizes="any" type="image/svg+xml"> <link rel="icon" href="images/favicon.svg" sizes="any" type="image/svg+xml">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"> <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="css/style.css"> <link rel="stylesheet" href="css/style.css">
@ -13,7 +13,7 @@
</head> </head>
<body> <body>
<header> <header>
<h1>tronnet</h1> <h1>proxmox</h1>
<label for="navtoggle">&#9776;</label> <label for="navtoggle">&#9776;</label>
<input type="checkbox" id="navtoggle"> <input type="checkbox" id="navtoggle">
<nav> <nav>

View File

@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>tronnet - client</title> <title>proxmox - client</title>
<link rel="icon" href="images/favicon.svg" sizes="any" type="image/svg+xml"> <link rel="icon" href="images/favicon.svg" sizes="any" type="image/svg+xml">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"> <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="css/style.css"> <link rel="stylesheet" href="css/style.css">
@ -12,7 +12,7 @@
</head> </head>
<body> <body>
<header> <header>
<h1>tronnet</h1> <h1>proxmox</h1>
<label for="navtoggle">&#9776;</label> <label for="navtoggle">&#9776;</label>
<input type="checkbox" id="navtoggle"> <input type="checkbox" id="navtoggle">
<nav> <nav>

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); window.addEventListener("DOMContentLoaded", init);
@ -11,6 +11,7 @@ let SIPrefix = [
] ]
async function init () { async function init () {
setTitleAndHeader();
let cookie = document.cookie; let cookie = document.cookie;
if (cookie === "") { if (cookie === "") {
goToPage("login.html"); 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"; import {alert, dialog} from "./dialog.js";
window.addEventListener("DOMContentLoaded", init); // do the dumb thing where the disk config refreshes every second window.addEventListener("DOMContentLoaded", init); // do the dumb thing where the disk config refreshes every second
@ -12,6 +12,7 @@ let vmid;
let config; let config;
async function init () { async function init () {
setTitleAndHeader();
let cookie = document.cookie; let cookie = document.cookie;
if (cookie === "") { if (cookie === "") {
goToPage("login.html"); 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 {alert, dialog} from "./dialog.js";
import {PVE} from "../vars.js" import {PVE} from "../vars.js"
window.addEventListener("DOMContentLoaded", init); window.addEventListener("DOMContentLoaded", init);
async function init () { async function init () {
setTitleAndHeader();
let cookie = document.cookie; let cookie = document.cookie;
if (cookie === "") { if (cookie === "") {
goToPage("login.html"); 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"; import {alert} from "./dialog.js";
window.addEventListener("DOMContentLoaded", init); window.addEventListener("DOMContentLoaded", init);
async function init (){ async function init (){
setTitleAndHeader();
await deleteAllCookies(); await deleteAllCookies();
let formSubmitButton = document.querySelector("#submit"); let formSubmitButton = document.querySelector("#submit");
let realms = await requestPVE("/access/domains", "GET"); 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 = { export const resources_config = {
disk: { disk: {
@ -164,7 +164,7 @@ export function goToPage (page, data={}, newwindow = false) {
} }
if (newwindow) { if (newwindow) {
window.open(url, "tronnet - client", "height=480,width=848"); window.open(url, `${organization} - client`, "height=480,width=848");
} }
else { else {
window.location.assign(url.toString()); window.location.assign(url.toString());
@ -178,7 +178,7 @@ export function goToURL (href, data={}, newwindow = false) {
} }
if (newwindow) { if (newwindow) {
window.open(url, "tronnet - client", "height=480,width=848"); window.open(url, `${organization} - client`, "height=480,width=848");
} }
else { else {
window.location.assign(url.toString()); window.location.assign(url.toString());
@ -193,3 +193,8 @@ export function getURIData () {
export async function deleteAllCookies () { export async function deleteAllCookies () {
await requestAPI("/ticket", "DELETE"); await requestAPI("/ticket", "DELETE");
} }
export function setTitleAndHeader () {
document.title = `${organization} - client`;
document.querySelector("h1").innerText = organization;
}

View File

@ -1,2 +1,3 @@
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 export const PVE = "https://pve.mydomain.example"; // the proxmox api
export const organization = "mydomain"; // org name used in page title and nav bar