Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the window title for the node manager to include a specified name from the config #488

Merged
merged 1 commit into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/rust/lqos_node_manager/src/config_control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
1 change: 1 addition & 0 deletions src/rust/lqos_node_manager/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/rust/lqos_node_manager/static/circuit_queue.html
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,7 @@ <h5 class="card-title"><i class="fa fa-bar-chart"></i> Flows (Last 30 Seconds)</
}

function start() {
setTitle();
wireUpTabEvents();
$("#btnPause").on('click', () => {
paused = !paused;
Expand Down
1 change: 1 addition & 0 deletions src/rust/lqos_node_manager/static/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,7 @@ <h2><i class="fa fa-users"></i> LibreQos Web Interface Users</h2>
}

function start() {
setTitle();
display();
colorReloadButton();
updateHostCounts();
Expand Down
7 changes: 7 additions & 0 deletions src/rust/lqos_node_manager/static/lqos.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
})
}
1 change: 1 addition & 0 deletions src/rust/lqos_node_manager/static/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,7 @@ <h5 class="card-title"><i class='fa fa-exclamation'></i> Worst 10
}

function start() {
setTitle();
if (isRedacted()) {
//console.log("Redacting");
//css_getclass(".redact").style.filter = "blur(4px)";
Expand Down
1 change: 1 addition & 0 deletions src/rust/lqos_node_manager/static/shaped.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ <h5 class="card-title"><i class="fa fa-users"></i> Shaped Devices</h5>
}

function start() {
setTitle();
colorReloadButton();
updateHostCounts();
$.get("/api/shaped_devices_count", (count) => {
Expand Down
1 change: 1 addition & 0 deletions src/rust/lqos_node_manager/static/tree.html
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ <h5 class="card-title"><i class="fa fa-users"></i> Attached Clients</h5>
}

function start() {
setTitle();
for (let i = 0; i < 20; ++i) rtt_histo.push(0);
colorReloadButton();
updateHostCounts();
Expand Down
Loading