diff --git a/Cargo.lock b/Cargo.lock index eb51cbd..a0724fa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -270,7 +270,7 @@ checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" [[package]] name = "cm-dashboard" -version = "0.1.50" +version = "0.1.51" dependencies = [ "anyhow", "chrono", @@ -291,7 +291,7 @@ dependencies = [ [[package]] name = "cm-dashboard-agent" -version = "0.1.50" +version = "0.1.51" dependencies = [ "anyhow", "async-trait", @@ -314,7 +314,7 @@ dependencies = [ [[package]] name = "cm-dashboard-shared" -version = "0.1.50" +version = "0.1.51" dependencies = [ "chrono", "serde", diff --git a/agent/Cargo.toml b/agent/Cargo.toml index 089f88e..28193b5 100644 --- a/agent/Cargo.toml +++ b/agent/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard-agent" -version = "0.1.51" +version = "0.1.52" edition = "2021" [dependencies] diff --git a/dashboard/Cargo.toml b/dashboard/Cargo.toml index dd4c88d..97426dd 100644 --- a/dashboard/Cargo.toml +++ b/dashboard/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard" -version = "0.1.51" +version = "0.1.52" edition = "2021" [dependencies] diff --git a/dashboard/src/ui/mod.rs b/dashboard/src/ui/mod.rs index c41144c..31c5247 100644 --- a/dashboard/src/ui/mod.rs +++ b/dashboard/src/ui/mod.rs @@ -244,14 +244,20 @@ impl TuiApp { KeyCode::Char('r') => { // System rebuild command - works on any panel for current host if let Some(hostname) = self.current_host.clone() { - // Create command that shows CM Dashboard logo and then rebuilds + // Create command that shows logo, rebuilds, and waits for user input let logo_and_rebuild = format!( - r"cat << 'EOF' + r"bash -c 'cat << \"EOF\" NixOS System Rebuild Target: {} EOF -ssh -tt {}@{} 'bash -ic {}'", +ssh -tt {}@{} \"bash -ic {}\" +echo +echo \"========================================\" +echo \"Rebuild completed. Press any key to close...\" +echo \"========================================\" +read -n 1 -s +exit'", hostname, self.config.ssh.rebuild_user, hostname, @@ -259,11 +265,10 @@ ssh -tt {}@{} 'bash -ic {}'", ); std::process::Command::new("tmux") - .arg("display-popup") - .arg("-w") - .arg("80%") - .arg("-h") - .arg("80%") + .arg("split-window") + .arg("-v") + .arg("-p") + .arg("30") .arg(&logo_and_rebuild) .spawn() .ok(); // Ignore errors, tmux will handle them @@ -286,49 +291,43 @@ ssh -tt {}@{} 'bash -ic {}'", } } KeyCode::Char('J') => { - // Show service logs via journalctl in tmux popup + // Show service logs via journalctl in tmux split window if let (Some(service_name), Some(hostname)) = (self.get_selected_service(), self.current_host.clone()) { let journalctl_command = format!( - "ssh -tt {}@{} 'sudo journalctl -u {}.service -f --no-pager -n 50'", + "bash -c \"ssh -tt {}@{} 'sudo journalctl -u {}.service -f --no-pager -n 50'; exit\"", self.config.ssh.rebuild_user, hostname, service_name ); std::process::Command::new("tmux") - .arg("display-popup") - .arg("-w") - .arg("80%") - .arg("-h") - .arg("80%") - .arg("-T") - .arg(format!("Logs: {}", service_name)) + .arg("split-window") + .arg("-v") + .arg("-p") + .arg("30") .arg(&journalctl_command) .spawn() .ok(); // Ignore errors, tmux will handle them } } KeyCode::Char('L') => { - // Show custom service log file in tmux popup + // Show custom service log file in tmux split window if let (Some(service_name), Some(hostname)) = (self.get_selected_service(), self.current_host.clone()) { // Check if this service has a custom log file configured if let Some(host_logs) = self.config.service_logs.get(&hostname) { if let Some(log_config) = host_logs.iter().find(|config| config.service_name == service_name) { let tail_command = format!( - "ssh -tt {}@{} 'sudo tail -n 50 -f {}'", + "bash -c \"ssh -tt {}@{} 'sudo tail -n 50 -f {}'; exit\"", self.config.ssh.rebuild_user, hostname, log_config.log_file_path ); std::process::Command::new("tmux") - .arg("display-popup") - .arg("-w") - .arg("80%") - .arg("-h") - .arg("80%") - .arg("-T") - .arg(format!("Custom Log: {}", service_name)) + .arg("split-window") + .arg("-v") + .arg("-p") + .arg("30") .arg(&tail_command) .spawn() .ok(); // Ignore errors, tmux will handle them diff --git a/shared/Cargo.toml b/shared/Cargo.toml index de0165f..04d9c55 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard-shared" -version = "0.1.51" +version = "0.1.52" edition = "2021" [dependencies]