--- a/mod_client_management/mod_client_management.lua Sat Sep 09 22:51:25 2023 +0200
+++ b/mod_client_management/mod_client_management.lua Mon Sep 11 10:19:38 2023 +0200
@@ -252,6 +252,7 @@
type = "access";
first_seen = grant.created;
last_seen = grant.accessed;
+ expires = grant.expires;
active = {
grant = grant;
};
@@ -438,9 +439,11 @@
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);
+ return last_seen and os.date(math.abs(os.difftime(os.time(), last_seen)) >= 86400 and "%Y-%m-%d" or "%H:%M:%S", last_seen);
end
+ local date_or_time_width = math.max(#os.date("%Y-%m-%d"), #os.date("%H:%M:%S"));
+
local colspec = {
{ title = "ID"; key = "id"; width = "1p" };
{
@@ -452,14 +455,21 @@
{
title = "First seen";
key = "first_seen";
- width = math.max(#os.date("%Y-%m-%d"), #os.date("%H:%M:%S"));
+ width = date_or_time_width;
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"));
+ width = date_or_time_width;
+ align = "right";
+ mapper = date_or_time;
+ };
+ {
+ title = "Expires";
+ key = "expires";
+ width = date_or_time_width;
align = "right";
mapper = date_or_time;
};