Fix dashboard title host ordering to use alphabetical sort
- Remove predefined host order that was causing random display order - Sort hosts alphabetically for consistent title display - Localhost is still auto-selected at startup but doesn't affect display order - Title will now show: cmbox ● labbox ● simonbox ● srv01 ● srv02 ● steambox Eliminates confusing random host order in dashboard title bar.
This commit is contained in:
parent
d4531ef2e8
commit
d349e2742d
@ -133,34 +133,13 @@ impl TuiApp {
|
||||
|
||||
/// Update available hosts with localhost prioritization
|
||||
pub fn update_hosts(&mut self, hosts: Vec<String>) {
|
||||
// Get the current hostname (localhost)
|
||||
let localhost = gethostname::gethostname().to_string_lossy().to_string();
|
||||
|
||||
// Sort hosts with localhost first, then others in predefined order
|
||||
let predefined_order = vec!["cmbox", "labbox", "simonbox", "steambox", "srv01", "srv02"];
|
||||
|
||||
let mut sorted_hosts = Vec::new();
|
||||
|
||||
// Add localhost first if it's available
|
||||
if hosts.contains(&localhost) {
|
||||
sorted_hosts.push(localhost.clone());
|
||||
}
|
||||
|
||||
// Add remaining hosts in predefined order
|
||||
for predefined_host in &predefined_order {
|
||||
if hosts.contains(&predefined_host.to_string()) && *predefined_host != localhost {
|
||||
sorted_hosts.push(predefined_host.to_string());
|
||||
}
|
||||
}
|
||||
|
||||
// Add any remaining hosts not in predefined order
|
||||
for host in &hosts {
|
||||
if !sorted_hosts.contains(host) {
|
||||
sorted_hosts.push(host.clone());
|
||||
}
|
||||
}
|
||||
|
||||
// Sort hosts alphabetically
|
||||
let mut sorted_hosts = hosts.clone();
|
||||
sorted_hosts.sort();
|
||||
self.available_hosts = sorted_hosts;
|
||||
|
||||
// Get the current hostname (localhost) for auto-selection
|
||||
let localhost = gethostname::gethostname().to_string_lossy().to_string();
|
||||
|
||||
// Prioritize localhost if it becomes available, but respect user navigation
|
||||
let localhost = gethostname::gethostname().to_string_lossy().to_string();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user