From 2beea9e16e0a330eff27c126e013d1ce7fc9bdf9 Mon Sep 17 00:00:00 2001 From: j Date: Fri, 2 Jan 2026 22:38:16 +1300 Subject: [PATCH] Update source/src/commands/list.cpp --- source/src/commands/list.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/source/src/commands/list.cpp b/source/src/commands/list.cpp index 47ca8e2..05d76a9 100644 --- a/source/src/commands/list.cpp +++ b/source/src/commands/list.cpp @@ -232,11 +232,21 @@ void show_server_details(const std::string& server_name) { info << std::endl << "Server Status:" << std::endl; info << std::string(40, '-') << std::endl; - + // Try to connect to the server (using our improved timeout) bool is_online = execute_ssh_command(sshinfo, sCommand("", "true", {}), cMode::Silent); + bool agent_match = false; + std::map service_status_map; + if (is_online) { info << "Status: Online" << std::endl; + // Get all service status and agent match in one call + service_status_map = shared_commands::get_all_services_status(env, &agent_match); + if (agent_match) { + info << "Agent: Up to date" << std::endl; + } else { + warning << "Agent: Out of date - run 'ds install " << server_name << "' to update" << std::endl; + } } else { warning << "Status: Offline" << std::endl; } @@ -272,23 +282,19 @@ void show_server_details(const std::string& server_name) { tp.add_row({"Status", "Service", "Template","Ports"}); if (is_online) { - std::map status = shared_commands::get_all_services_status(server_name); - - std::set ports_used; - std::string serviceticks = ""; - for (const auto& [service_name, service_status] : status) { + for (const auto& [service_name, service_status] : service_status_map) { std::string healthy = shared_commands::HealthStatus2String(service_status.health); - + std::string ports_str = ""; - for (const auto& port : service_status.ports) + for (const auto& port : service_status.ports) ports_str += std::to_string(port) + " "; std::string template_name = get_service_info(server_name,service_name).template_name; if (template_name.empty()) template_name = "Unknown"; - + tp.add_row({healthy, service_name, template_name, ports_str}); - } // end of for (const auto& service : services) + } } else { // Server is offline, just list services without checking their status std::vector services = get_server_services_info(server_name);