Development

This commit is contained in:
Matthew Grotke 2026-06-01 23:09:45 -04:00
parent 0e18010353
commit 8129b2f757
2 changed files with 5 additions and 10 deletions

View file

@ -54,12 +54,8 @@
"field": "vlan_name" "field": "vlan_name"
}, },
{ {
"label": "Last Active", "label": "Renews",
"field": "last_active" "field": "renews"
},
{
"label": "Expires",
"field": "expires"
}, },
{ {
"label": "Recent", "label": "Recent",

View file

@ -26,7 +26,7 @@ def _get_vendor(mac):
if _mac_parser is None: if _mac_parser is None:
return '' return ''
try: try:
return _mac_parser.get_manuf(mac) or '' return _mac_parser.get_comment(mac) or _mac_parser.get_manuf(mac) or ''
except Exception: except Exception:
return '' return ''
@ -217,7 +217,7 @@ def live_dhcp_leases():
if expiry < now: if expiry < now:
continue continue
obtained_ts = (expiry - lease_secs) if lease_secs else None obtained_ts = (expiry - lease_secs) if lease_secs else None
obtained = relative_time(obtained_ts) if obtained_ts else '-' renews_ts = (expiry - lease_secs // 2) if lease_secs else None
recent = (obtained_ts is not None and restart_time is not None recent = (obtained_ts is not None and restart_time is not None
and obtained_ts >= restart_time) and obtained_ts >= restart_time)
mac_norm = parts[1].lower() mac_norm = parts[1].lower()
@ -237,8 +237,7 @@ def live_dhcp_leases():
'mac_address': parts[1], 'mac_address': parts[1],
'vendor': _get_vendor(parts[1]), 'vendor': _get_vendor(parts[1]),
'vlan_name': vlan_name, 'vlan_name': vlan_name,
'last_active': obtained, 'renews': relative_time_future(renews_ts) if renews_ts else relative_time_future(expiry),
'expires': relative_time_future(expiry),
'recent': recent, 'recent': recent,
}) })
except Exception: except Exception: