Merge pull request #488 from LibreQoE/node_manager_show_name

Change the window title for the node manager to include a specified name from the config
This commit is contained in:
Herbert "TheBracket 2024-05-30 10:11:02 -05:00 committed by GitHub
commit 36d41911f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 22 additions and 0 deletions

View File

@ -6,6 +6,15 @@ use rocket::{fs::NamedFile, serde::{json::Json, Serialize, Deserialize}};
use rocket::serde::json::Value;
use crate::tracker::SHAPED_DEVICES;
#[get("/api/node_name")]
pub async fn get_node_name() -> Json<String> {
if let Ok(config) = lqos_config::load_config() {
Json(config.node_name)
} else {
Json("No Name Provided".to_string())
}
}
// Note that NoCache can be replaced with a cache option
// once the design work is complete.
#[get("/config")]

View File

@ -89,6 +89,7 @@ fn rocket() -> _ {
config_control::update_network_and_devices,
config_control::update_lqos_tuning,
config_control::update_lqosd_config,
config_control::get_node_name,
auth_guard::create_first_user,
auth_guard::login,
auth_guard::admin_check,

View File

@ -949,6 +949,7 @@
}
function start() {
setTitle();
wireUpTabEvents();
$("#btnPause").on('click', () => {
paused = !paused;

View File

@ -1007,6 +1007,7 @@
}
function start() {
setTitle();
display();
colorReloadButton();
updateHostCounts();

View File

@ -497,3 +497,10 @@ function ipToHostname(ip) {
})
return ip;
}
function setTitle() {
$.get("/api/node_name", (name) => {
// Set the window title
document.title = name + " - LibreQoS Node Manager";
})
}

View File

@ -558,6 +558,7 @@
}
function start() {
setTitle();
if (isRedacted()) {
//console.log("Redacting");
//css_getclass(".redact").style.filter = "blur(4px)";

View File

@ -135,6 +135,7 @@
}
function start() {
setTitle();
colorReloadButton();
updateHostCounts();
$.get("/api/shaped_devices_count", (count) => {

View File

@ -270,6 +270,7 @@
}
function start() {
setTitle();
for (let i = 0; i < 20; ++i) rtt_histo.push(0);
colorReloadButton();
updateHostCounts();