From 44ea86e59aa640066c79bc20ce8a71262b3a955c Mon Sep 17 00:00:00 2001 From: SergeantPanda Date: Thu, 24 Apr 2025 20:30:04 -0500 Subject: [PATCH] Show connected time for each client. --- frontend/src/pages/Stats.jsx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/frontend/src/pages/Stats.jsx b/frontend/src/pages/Stats.jsx index e8f1b7e8..dd2c013b 100644 --- a/frontend/src/pages/Stats.jsx +++ b/frontend/src/pages/Stats.jsx @@ -179,6 +179,30 @@ const ChannelCard = ({ channel, clients, stopClient, stopChannel, logos, channel accessorKey: 'ip_address', size: 50, }, + { + header: 'Connected', + accessorFn: (row) => { + // Calculate based on connected_since (time elapsed since connection) + if (row.connected_since) { + // Current time minus the elapsed time gives us the connection timestamp + const connectedTime = dayjs().subtract(row.connected_since, 'second'); + return connectedTime.format('MM/DD HH:mm:ss'); + } + return 'Unknown'; + }, + size: 50, + }, + { + header: 'Duration', + accessorFn: (row) => { + // Use connected_since directly as it's already the duration + if (row.connected_since) { + return dayjs.duration(row.connected_since, 'seconds').humanize(); + } + return '-'; + }, + size: 50, + } ], [] );