diff --git a/src/rust/lqos_node_manager/src/config_control.rs b/src/rust/lqos_node_manager/src/config_control.rs index 4bc5c5a3..e3e70966 100644 --- a/src/rust/lqos_node_manager/src/config_control.rs +++ b/src/rust/lqos_node_manager/src/config_control.rs @@ -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 { + 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")] diff --git a/src/rust/lqos_node_manager/src/main.rs b/src/rust/lqos_node_manager/src/main.rs index 16c2bf1c..03324f79 100644 --- a/src/rust/lqos_node_manager/src/main.rs +++ b/src/rust/lqos_node_manager/src/main.rs @@ -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, diff --git a/src/rust/lqos_node_manager/static/circuit_queue.html b/src/rust/lqos_node_manager/static/circuit_queue.html index d58edaeb..85a5fad2 100644 --- a/src/rust/lqos_node_manager/static/circuit_queue.html +++ b/src/rust/lqos_node_manager/static/circuit_queue.html @@ -949,6 +949,7 @@ } function start() { + setTitle(); wireUpTabEvents(); $("#btnPause").on('click', () => { paused = !paused; diff --git a/src/rust/lqos_node_manager/static/config.html b/src/rust/lqos_node_manager/static/config.html index e6ff0bb4..f895a470 100644 --- a/src/rust/lqos_node_manager/static/config.html +++ b/src/rust/lqos_node_manager/static/config.html @@ -1007,6 +1007,7 @@ } function start() { + setTitle(); display(); colorReloadButton(); updateHostCounts(); diff --git a/src/rust/lqos_node_manager/static/lqos.js b/src/rust/lqos_node_manager/static/lqos.js index 3abe56d7..133fe4ff 100644 --- a/src/rust/lqos_node_manager/static/lqos.js +++ b/src/rust/lqos_node_manager/static/lqos.js @@ -496,4 +496,11 @@ function ipToHostname(ip) { dnsCache[ip] = hostname; }) return ip; +} + +function setTitle() { + $.get("/api/node_name", (name) => { + // Set the window title + document.title = name + " - LibreQoS Node Manager"; + }) } \ No newline at end of file diff --git a/src/rust/lqos_node_manager/static/main.html b/src/rust/lqos_node_manager/static/main.html index e38c1407..86952fd3 100644 --- a/src/rust/lqos_node_manager/static/main.html +++ b/src/rust/lqos_node_manager/static/main.html @@ -558,6 +558,7 @@ } function start() { + setTitle(); if (isRedacted()) { //console.log("Redacting"); //css_getclass(".redact").style.filter = "blur(4px)"; diff --git a/src/rust/lqos_node_manager/static/shaped.html b/src/rust/lqos_node_manager/static/shaped.html index aab93352..cbd9dccd 100644 --- a/src/rust/lqos_node_manager/static/shaped.html +++ b/src/rust/lqos_node_manager/static/shaped.html @@ -135,6 +135,7 @@ } function start() { + setTitle(); colorReloadButton(); updateHostCounts(); $.get("/api/shaped_devices_count", (count) => { diff --git a/src/rust/lqos_node_manager/static/tree.html b/src/rust/lqos_node_manager/static/tree.html index 2fe55415..c7bee389 100644 --- a/src/rust/lqos_node_manager/static/tree.html +++ b/src/rust/lqos_node_manager/static/tree.html @@ -270,6 +270,7 @@ } function start() { + setTitle(); for (let i = 0; i < 20; ++i) rtt_histo.push(0); colorReloadButton(); updateHostCounts();