From 564d1f37e70f613957e0074a4dce1e3afd9072f0 Mon Sep 17 00:00:00 2001 From: Christoffer Martinsson Date: Wed, 19 Nov 2025 12:30:36 +0100 Subject: [PATCH] Streamline service commands with auto-close functionality - Remove header text from start/stop commands for cleaner output - Add automatic log termination when service reaches target state - Start command auto-closes when service becomes active - Stop command auto-closes when service becomes inactive - Simplify SSH command structure by removing bash -c wrapper - Version bump to 0.1.85 --- Cargo.lock | 6 +++--- agent/Cargo.toml | 2 +- dashboard/Cargo.toml | 2 +- dashboard/src/ui/mod.rs | 14 ++++++-------- shared/Cargo.toml | 2 +- 5 files changed, 12 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b4ae8bc..f5a3963 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -270,7 +270,7 @@ checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" [[package]] name = "cm-dashboard" -version = "0.1.83" +version = "0.1.84" dependencies = [ "anyhow", "chrono", @@ -292,7 +292,7 @@ dependencies = [ [[package]] name = "cm-dashboard-agent" -version = "0.1.83" +version = "0.1.84" dependencies = [ "anyhow", "async-trait", @@ -315,7 +315,7 @@ dependencies = [ [[package]] name = "cm-dashboard-shared" -version = "0.1.83" +version = "0.1.84" dependencies = [ "chrono", "serde", diff --git a/agent/Cargo.toml b/agent/Cargo.toml index bc291a1..9bd9bf5 100644 --- a/agent/Cargo.toml +++ b/agent/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard-agent" -version = "0.1.84" +version = "0.1.85" edition = "2021" [dependencies] diff --git a/dashboard/Cargo.toml b/dashboard/Cargo.toml index a8291c9..acfdac0 100644 --- a/dashboard/Cargo.toml +++ b/dashboard/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard" -version = "0.1.84" +version = "0.1.85" edition = "2021" [dependencies] diff --git a/dashboard/src/ui/mod.rs b/dashboard/src/ui/mod.rs index 08e7f08..2d2ba8e 100644 --- a/dashboard/src/ui/mod.rs +++ b/dashboard/src/ui/mod.rs @@ -267,13 +267,12 @@ impl TuiApp { if let (Some(service_name), Some(hostname)) = (self.get_selected_service(), self.current_host.clone()) { let connection_ip = self.get_connection_ip(&hostname); let service_start_command = format!( - "bash -c 'cat << \"EOF\"\nService Start: {}\nTarget: {} ({})\n\nEOF\nssh -tt {}@{} \"echo \\\"Starting service and following logs (Ctrl+C to stop):\\\" && echo \\\"========================================\\\" && sudo systemctl start {} & sudo journalctl -fu {} --since=\\\"1 second ago\\\" --no-pager\"\necho\necho \"========================================\"\necho \"Operation completed. Press any key to close...\"\necho \"========================================\"\nread -n 1 -s\nexit'", - service_name, - hostname, - connection_ip, + "ssh -tt {}@{} \"sudo systemctl start {} & sudo journalctl -fu {} --since=\\\"1 second ago\\\" --no-pager & while ! systemctl is-active {} >/dev/null 2>&1; do sleep 0.5; done; pkill -f 'journalctl -fu {}'\"", self.config.ssh.rebuild_user, connection_ip, service_name, + service_name, + service_name, service_name ); @@ -292,13 +291,12 @@ impl TuiApp { if let (Some(service_name), Some(hostname)) = (self.get_selected_service(), self.current_host.clone()) { let connection_ip = self.get_connection_ip(&hostname); let service_stop_command = format!( - "bash -c 'cat << \"EOF\"\nService Stop: {}\nTarget: {} ({})\n\nEOF\nssh -tt {}@{} \"echo \\\"Stopping service and following logs (Ctrl+C to stop):\\\" && echo \\\"========================================\\\" && sudo systemctl stop {} & sudo journalctl -fu {} --since=\\\"1 second ago\\\" --no-pager\"\necho\necho \"========================================\"\necho \"Operation completed. Press any key to close...\"\necho \"========================================\"\nread -n 1 -s\nexit'", - service_name, - hostname, - connection_ip, + "ssh -tt {}@{} \"sudo systemctl stop {} & sudo journalctl -fu {} --since=\\\"1 second ago\\\" --no-pager & while systemctl is-active {} >/dev/null 2>&1; do sleep 0.5; done; pkill -f 'journalctl -fu {}'\"", self.config.ssh.rebuild_user, connection_ip, service_name, + service_name, + service_name, service_name ); diff --git a/shared/Cargo.toml b/shared/Cargo.toml index 22e6a8e..12f66f3 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard-shared" -version = "0.1.84" +version = "0.1.85" edition = "2021" [dependencies]