# HG changeset patch # User Kim Alvefur # Date 1692177448 -7200 # Node ID 1571c280aaef9273364c9fcee0c3965d98123d61 # Parent f889ff77957188c9768958fca74664168a619091 mod_client_management: Show timestamp of first client appearance diff -r f889ff779571 -r 1571c280aaef mod_client_management/mod_client_management.lua --- 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";