feat: implement server-wide management actions and enhance TUI dashboard

This commit is contained in:
2026-03-04 20:51:02 +00:00
parent 150f9d2990
commit ddec55871b
13 changed files with 621 additions and 52 deletions
+17 -4
View File
@@ -10,6 +10,7 @@ const (
ScreenAgentList // list all agents with status
ScreenAgentActions // actions for a selected agent
ScreenLogs // tail log output
ScreenServer // server-wide process management
)
// Model is the complete TUI state — pure data.
@@ -34,10 +35,11 @@ type AgentView struct {
Enabled bool
Running bool
PID int
Uptime string // formatted: "2h 15m"
Memory string // formatted: "42 MB"
CPU string // formatted: "1.2%"
LogSize string // formatted: "350 KB"
Instances int // number of running instances (>1 means duplicates)
Uptime string // formatted: "2h 15m"
Memory string // formatted: "42 MB"
CPU string // formatted: "1.2%"
LogSize string // formatted: "350 KB"
}
// MenuOption represents a selectable menu item.
@@ -50,10 +52,21 @@ type MenuOption struct {
func MainMenuOptions() []MenuOption {
return []MenuOption{
{Label: "Agents", Desc: "Gestionar agentes"},
{Label: "Server", Desc: "Gestionar servidor"},
{Label: "Quit", Desc: "Salir"},
}
}
// ServerMenuOptions returns the available server-wide actions.
func ServerMenuOptions() []MenuOption {
return []MenuOption{
{Label: "Start All", Desc: "Iniciar todos los agentes habilitados"},
{Label: "Stop All", Desc: "Detener todos los agentes"},
{Label: "Restart All", Desc: "Reiniciar todos los agentes"},
{Label: "Kill All", Desc: "SIGKILL forzado a todos"},
}
}
// AgentActionOptions returns the available actions based on agent state.
func AgentActionOptions(running bool) []MenuOption {
if running {