changeset 5632:1571c280aaef

mod_client_management: Show timestamp of first client appearance
author Kim Alvefur <zash@zash.se>
date Wed, 16 Aug 2023 11:17:28 +0200
parents f889ff779571
children dd2079b3dec6
files mod_client_management/mod_client_management.lua
diffstat 1 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mod_client_management/mod_client_management.lua	Tue Aug 08 17:04:50 2023 +0200
+++ b/mod_client_management/mod_client_management.lua	Wed Aug 16 11:17:28 2023 +0200
@@ -437,6 +437,10 @@
 			return true, "No clients associated with this account";
 		end
 
+		local function date_or_time(last_seen)
+			return last_seen and os.date(os.difftime(os.time(), last_seen) >= 86400 and "%Y-%m-%d" or "%H:%M:%S", last_seen);
+		end
+
 		local colspec = {
 			{ title = "ID"; key = "id"; width = "1p" };
 			{
@@ -446,13 +450,18 @@
 				mapper = user_agent_tostring;
 			};
 			{
+				title = "First seen";
+				key = "first_seen";
+				width = math.max(#os.date("%Y-%m-%d"), #os.date("%H:%M:%S"));
+				align = "right";
+				mapper = date_or_time;
+			};
+			{
 				title = "Last seen";
 				key = "last_seen";
 				width = math.max(#os.date("%Y-%m-%d"), #os.date("%H:%M:%S"));
 				align = "right";
-				mapper = function(last_seen)
-					return last_seen and os.date(os.difftime(os.time(), last_seen) >= 86400 and "%Y-%m-%d" or "%H:%M:%S", last_seen);
-				end;
+				mapper = date_or_time;
 			};
 			{
 				title = "Authentication";