Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2384f7f9b9 |
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "cm-dashboard-agent"
|
name = "cm-dashboard-agent"
|
||||||
version = "0.1.92"
|
version = "0.1.93"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "cm-dashboard"
|
name = "cm-dashboard"
|
||||||
version = "0.1.92"
|
version = "0.1.93"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ pub struct SshConfig {
|
|||||||
pub rebuild_user: String,
|
pub rebuild_user: String,
|
||||||
pub rebuild_cmd: String,
|
pub rebuild_cmd: String,
|
||||||
pub service_manage_cmd: String,
|
pub service_manage_cmd: String,
|
||||||
|
pub service_logs_cmd: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Service log file configuration per host
|
/// Service log file configuration per host
|
||||||
|
|||||||
@@ -310,16 +310,15 @@ impl TuiApp {
|
|||||||
.ok(); // Ignore errors, tmux will handle them
|
.ok(); // Ignore errors, tmux will handle them
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
KeyCode::Char('J') => {
|
KeyCode::Char('L') => {
|
||||||
// Show service logs via journalctl in tmux split window
|
// Show service logs via script in tmux split window
|
||||||
if let (Some(service_name), Some(hostname)) = (self.get_selected_service(), self.current_host.clone()) {
|
if let (Some(service_name), Some(hostname)) = (self.get_selected_service(), self.current_host.clone()) {
|
||||||
let connection_ip = self.get_connection_ip(&hostname);
|
let connection_ip = self.get_connection_ip(&hostname);
|
||||||
let journalctl_command = format!(
|
let logs_command = format!(
|
||||||
"echo 'Viewing logs for service: {} on {}' && ssh -tt {}@{} 'sudo journalctl -u {}.service -f --no-pager -n 50'",
|
"ssh -tt {}@{} '{} {}'",
|
||||||
service_name,
|
|
||||||
hostname,
|
|
||||||
self.config.ssh.rebuild_user,
|
self.config.ssh.rebuild_user,
|
||||||
connection_ip,
|
connection_ip,
|
||||||
|
self.config.ssh.service_logs_cmd,
|
||||||
service_name
|
service_name
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -328,39 +327,11 @@ impl TuiApp {
|
|||||||
.arg("-v")
|
.arg("-v")
|
||||||
.arg("-p")
|
.arg("-p")
|
||||||
.arg("30")
|
.arg("30")
|
||||||
.arg(&journalctl_command)
|
.arg(&logs_command)
|
||||||
.spawn()
|
.spawn()
|
||||||
.ok(); // Ignore errors, tmux will handle them
|
.ok(); // Ignore errors, tmux will handle them
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
KeyCode::Char('L') => {
|
|
||||||
// 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 connection_ip = self.get_connection_ip(&hostname);
|
|
||||||
let tail_command = format!(
|
|
||||||
"echo 'Viewing custom logs for service: {} on {}' && ssh -tt {}@{} 'sudo tail -n 50 -f {}'",
|
|
||||||
service_name,
|
|
||||||
hostname,
|
|
||||||
self.config.ssh.rebuild_user,
|
|
||||||
connection_ip,
|
|
||||||
log_config.log_file_path
|
|
||||||
);
|
|
||||||
|
|
||||||
std::process::Command::new("tmux")
|
|
||||||
.arg("split-window")
|
|
||||||
.arg("-v")
|
|
||||||
.arg("-p")
|
|
||||||
.arg("30")
|
|
||||||
.arg(&tail_command)
|
|
||||||
.spawn()
|
|
||||||
.ok(); // Ignore errors, tmux will handle them
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
KeyCode::Char('w') => {
|
KeyCode::Char('w') => {
|
||||||
// Wake on LAN for offline hosts
|
// Wake on LAN for offline hosts
|
||||||
if let Some(hostname) = self.current_host.clone() {
|
if let Some(hostname) = self.current_host.clone() {
|
||||||
@@ -747,9 +718,10 @@ impl TuiApp {
|
|||||||
shortcuts.push("Tab: Host".to_string());
|
shortcuts.push("Tab: Host".to_string());
|
||||||
shortcuts.push("↑↓/jk: Select".to_string());
|
shortcuts.push("↑↓/jk: Select".to_string());
|
||||||
shortcuts.push("r: Rebuild".to_string());
|
shortcuts.push("r: Rebuild".to_string());
|
||||||
|
shortcuts.push("B: Backup".to_string());
|
||||||
shortcuts.push("s/S: Start/Stop".to_string());
|
shortcuts.push("s/S: Start/Stop".to_string());
|
||||||
shortcuts.push("J: Logs".to_string());
|
shortcuts.push("L: Logs".to_string());
|
||||||
shortcuts.push("L: Custom".to_string());
|
shortcuts.push("t: Terminal".to_string());
|
||||||
shortcuts.push("w: Wake".to_string());
|
shortcuts.push("w: Wake".to_string());
|
||||||
|
|
||||||
// Always show quit
|
// Always show quit
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "cm-dashboard-shared"
|
name = "cm-dashboard-shared"
|
||||||
version = "0.1.92"
|
version = "0.1.93"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
Reference in New Issue
Block a user