Bug fixing.

This commit is contained in:
Your Name
2025-04-25 20:31:25 +12:00
parent f73e6f1ac5
commit d0b7c27af3
6 changed files with 30 additions and 95 deletions

View File

@ -128,26 +128,19 @@ void show_server_details(const std::string& server_name) {
tableprint tp("Services: " + server_name, false);
tp.add_row({"Status", "Service", "Ports"});
std::vector<ServiceInfo> services = get_server_services_info(server_name);
for (const auto& service : services) {
std::string healthy = "?";
std::vector<int> ports;
service_runner ss;
if (ss.init(server_name, service.service_name))
{
healthy = ss.healthmark();
ports = ss.get_ports();
}
bool first = true;
std::map<std::string, ServiceStatus> status = service_runner::get_all_services_status(server_name);
std::set<int> ports_used;
std::string serviceticks = "";
for (const auto& [service_name, service_status] : status) {
std::string healthy = service_runner::HealthStatus2String(service_status.health);
std::string ports_str = "";
for (const auto& port : ports) {
if (!first) {
ports_str += ", ";
}
ports_str += std::to_string(port);
first = false;
}
tp.add_row({healthy, service.service_name, ports_str});
for (const auto& port : service_status.ports)
ports_str += std::to_string(port) + " ";
tp.add_row({healthy, service_name, ports_str});
} // end of for (const auto& service : services)
tp.print();
} // end of list services