Added number of agents to listener list

This commit is contained in:
Jakob Friedl
2025-05-15 15:24:46 +02:00
parent 9d652df4e3
commit 56f8994069
4 changed files with 19 additions and 22 deletions

View File

@@ -1,4 +1,4 @@
import re, strutils, strformat, terminal
import re, strutils, strformat, terminal, tables, sequtils
import ./types
@@ -61,8 +61,10 @@ proc drawTable*(cq: Conquest, listeners: seq[Listener]) =
cq.writeLine(border(midLeft, midMid, midRight, widths))
for l in listeners:
# TODO: Add number of agents connected to the listener
let row = @[l.name, l.address, $l.port, $l.protocol, "X"]
# Get number of agents connected to the listener
let connectedAgents = cq.agents.values.countIt(it.listener == l.name)
let row = @[l.name, l.address, $l.port, $l.protocol, $connectedAgents]
cq.writeLine(row(row, widths))
cq.writeLine(border(botLeft, botMid, botRight, widths))