Implement remote command execution and visual feedback for service control
This implements the core functionality for executing remote commands through the dashboard and providing real-time visual feedback to users. Key Features: - Remote service control (start/stop/restart) via existing keyboard shortcuts - System rebuild command with maintenance mode integration - Real-time visual feedback with service status transitions - ZMQ command protocol extension for service and system operations Implementation Details: - Extended AgentCommand enum with ServiceControl and SystemRebuild variants - Added agent-side handlers for systemctl and nixos-rebuild execution - Implemented command status tracking system for visual feedback - Enhanced services widget to show progress states (⏳ restarting) - Integrated command execution with existing keyboard navigation Keyboard Controls: - Services Panel: Space (start/stop), R (restart) - System Panel: R (nixos-rebuild switch) - Backup Panel: B (trigger backup) Technical Architecture: - Command flow: UI → Dashboard → ZMQ → Agent → systemctl/nixos-rebuild - Status tracking: InProgress/Success/Failed states with visual indicators - Maintenance mode: Automatic /tmp/cm-maintenance file management - Service feedback: Icon transitions (● → ⏳ → ● with status text)
This commit is contained in:
@@ -99,4 +99,22 @@ pub enum AgentCommand {
|
||||
ToggleCollector { name: String, enabled: bool },
|
||||
/// Request status/health check
|
||||
Ping,
|
||||
/// Control systemd service
|
||||
ServiceControl {
|
||||
service_name: String,
|
||||
action: ServiceAction,
|
||||
},
|
||||
/// Rebuild NixOS system
|
||||
SystemRebuild {
|
||||
nixos_path: String, // Path to nixosbox directory
|
||||
},
|
||||
}
|
||||
|
||||
/// Service control actions
|
||||
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize)]
|
||||
pub enum ServiceAction {
|
||||
Start,
|
||||
Stop,
|
||||
Restart,
|
||||
Status,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user