mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-10-18 11:02:54 +00:00
feat: Add start-all and stop-all commands to services with simulation output and table display
- Add "start-all" and "stop-all" cases to services command handler - Add startAllServices function with table output for service name, status, and message - Add stopAllServices function with reverse service order for graceful shutdown - Add service list iteration with status display for api-server, charging-engine, carrier-connector, packet-gateway, and web-dashboard - Add "start-all" and "stop-all" commands
This commit is contained in:
@@ -27,6 +27,10 @@ func HandleServices(args []string, config *types.CLIConfig) error {
|
||||
return restartService(u, args[1:])
|
||||
case "logs":
|
||||
return showServiceLogs(u, args[1:])
|
||||
case "start-all":
|
||||
return startAllServices(u)
|
||||
case "stop-all":
|
||||
return stopAllServices(u)
|
||||
default:
|
||||
u.errorln("Unknown services command: " + command)
|
||||
showServicesHelp(u)
|
||||
@@ -46,6 +50,8 @@ func showServicesHelp(u *uiContext) {
|
||||
t.AddRow("status <service>", "Show service status")
|
||||
t.AddRow("restart <service>", "Restart a service")
|
||||
t.AddRow("logs <service>", "Show service logs")
|
||||
t.AddRow("start-all", "Start all platform services")
|
||||
t.AddRow("stop-all", "Stop all platform services")
|
||||
fmt.Println(t.Render())
|
||||
}
|
||||
|
||||
@@ -162,3 +168,47 @@ func showServiceLogs(u *uiContext, args []string) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func startAllServices(u *uiContext) error {
|
||||
u.header("Starting All Platform Services")
|
||||
u.muted("(Service orchestration API not yet connected - showing simulation)")
|
||||
|
||||
services := []string{"api-server", "charging-engine", "carrier-connector", "packet-gateway", "web-dashboard"}
|
||||
|
||||
t := u.newTable()
|
||||
t.AddColumn("Service", 18, "left")
|
||||
t.AddColumn("Status", 12, "left")
|
||||
t.AddColumn("Message", 40, "left")
|
||||
|
||||
for _, svc := range services {
|
||||
u.info("Starting " + svc + "...")
|
||||
t.AddStyledRow(statusStyle("OK").Style, svc, "Starting", "Initiating service startup")
|
||||
}
|
||||
|
||||
fmt.Println(t.Render())
|
||||
u.success("All services start sequence initiated!")
|
||||
u.muted("Note: This is a simulation. Implement actual service orchestration via Kubernetes API or process manager.")
|
||||
return nil
|
||||
}
|
||||
|
||||
func stopAllServices(u *uiContext) error {
|
||||
u.header("Stopping All Platform Services")
|
||||
u.muted("(Service orchestration API not yet connected - showing simulation)")
|
||||
|
||||
services := []string{"web-dashboard", "packet-gateway", "carrier-connector", "charging-engine", "api-server"}
|
||||
|
||||
t := u.newTable()
|
||||
t.AddColumn("Service", 18, "left")
|
||||
t.AddColumn("Status", 12, "left")
|
||||
t.AddColumn("Message", 40, "left")
|
||||
|
||||
for _, svc := range services {
|
||||
u.info("Stopping " + svc + "...")
|
||||
t.AddStyledRow(statusStyle("OK").Style, svc, "Stopping", "Initiating graceful shutdown")
|
||||
}
|
||||
|
||||
fmt.Println(t.Render())
|
||||
u.success("All services stop sequence initiated!")
|
||||
u.muted("Note: This is a simulation. Implement actual service orchestration via Kubernetes API or process manager.")
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user