Add service logs feature and improve tmux popup sizing
All checks were successful
Build and Release / build-and-release (push) Successful in 2m9s
All checks were successful
Build and Release / build-and-release (push) Successful in 2m9s
New Features: - Add journalctl service logs viewer via Shift+J key - Opens tmux popup with real-time log streaming using journalctl -f - Shows last 50 lines and follows new log entries for selected service - Popup titled 'Logs: service.service' for clear context Improvements: - Increase tmux popup size to 80% width and height for better readability - Applies to both rebuild (R) and logs (J) popups - Compact status line text to fit new J: Logs shortcut - Updated documentation with new key binding Navigation Updates: - J: Show service logs (journalctl in tmux popup) - Status line: Tab: Host • ↑↓/jk: Select • r: Rebuild • s/S: Start/Stop • J: Logs • q: Quit Bump version to v0.1.46
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "cm-dashboard"
|
||||
version = "0.1.45"
|
||||
version = "0.1.46"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
||||
@@ -260,6 +260,10 @@ ssh -tt {}@{} 'bash -ic {}'",
|
||||
|
||||
std::process::Command::new("tmux")
|
||||
.arg("display-popup")
|
||||
.arg("-w")
|
||||
.arg("80%")
|
||||
.arg("-h")
|
||||
.arg("80%")
|
||||
.arg(&logo_and_rebuild)
|
||||
.spawn()
|
||||
.ok(); // Ignore errors, tmux will handle them
|
||||
@@ -281,6 +285,29 @@ ssh -tt {}@{} 'bash -ic {}'",
|
||||
}
|
||||
}
|
||||
}
|
||||
KeyCode::Char('J') => {
|
||||
// Show service logs via journalctl in tmux popup
|
||||
if let (Some(service_name), Some(hostname)) = (self.get_selected_service(), self.current_host.clone()) {
|
||||
let journalctl_command = format!(
|
||||
"ssh -tt {}@{} 'journalctl -u {}.service -f --no-pager -n 50'",
|
||||
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", service_name))
|
||||
.arg(&journalctl_command)
|
||||
.spawn()
|
||||
.ok(); // Ignore errors, tmux will handle them
|
||||
}
|
||||
}
|
||||
KeyCode::Char('b') => {
|
||||
// Trigger backup
|
||||
if let Some(hostname) = self.current_host.clone() {
|
||||
@@ -686,10 +713,11 @@ ssh -tt {}@{} 'bash -ic {}'",
|
||||
let mut shortcuts = Vec::new();
|
||||
|
||||
// Global shortcuts
|
||||
shortcuts.push("Tab: Switch Host".to_string());
|
||||
shortcuts.push("↑↓/jk: Select Service".to_string());
|
||||
shortcuts.push("r: Rebuild Host".to_string());
|
||||
shortcuts.push("s/S: Start/Stop Service".to_string());
|
||||
shortcuts.push("Tab: Host".to_string());
|
||||
shortcuts.push("↑↓/jk: Select".to_string());
|
||||
shortcuts.push("r: Rebuild".to_string());
|
||||
shortcuts.push("s/S: Start/Stop".to_string());
|
||||
shortcuts.push("J: Logs".to_string());
|
||||
|
||||
// Always show quit
|
||||
shortcuts.push("q: Quit".to_string());
|
||||
|
||||
Reference in New Issue
Block a user