Development

This commit is contained in:
Matthew Grotke 2026-06-01 22:12:11 -04:00
parent 9f1b4a9119
commit 8eec61a1df
8 changed files with 697 additions and 56 deletions

View file

@ -48,9 +48,18 @@
"label": "VLAN",
"field": "vlan_name"
},
{
"label": "Obtained",
"field": "obtained"
},
{
"label": "Expires",
"field": "expires"
},
{
"label": "Recent",
"field": "recent",
"render": "badge_yes_no"
}
]
}

View file

@ -45,12 +45,12 @@ def options_save():
return redirect(f'/{_PAGE}')
cfg = load_config()
before = copy.deepcopy(cfg.get('free_radius', {}).get('options', {}))
before = copy.deepcopy(cfg.get('radius', {}).get('options', {}))
after = {'mac_format': mac_format, 'apply_to': apply_to}
cfg.setdefault('free_radius', {})['options'] = after
cfg.setdefault('radius', {})['options'] = after
changes = diff_fields(before, after)
flash(record_group(cfg, 'free_radius.options', 'setting', 'free_radius', changes, 'core apply'), 'success')
flash(record_group(cfg, 'radius.options', 'setting', 'radius', changes, 'core apply'), 'success')
return redirect(f'/{_PAGE}')
@ -64,12 +64,12 @@ def logging_save():
logging = 'logging' in request.form
cfg = load_config()
before = copy.deepcopy(cfg.get('free_radius', {}).get('general', {}))
before = copy.deepcopy(cfg.get('radius', {}).get('general', {}))
after = {'logging': logging, 'log_max_kb': log_max_kb}
cfg.setdefault('free_radius', {})['general'] = after
cfg.setdefault('radius', {})['general'] = after
changes = diff_fields(before, after)
flash(record_group(cfg, 'free_radius.general', 'setting', 'free_radius', changes, 'core apply'), 'success')
flash(record_group(cfg, 'radius.general', 'setting', 'radius', changes, 'core apply'), 'success')
return redirect(f'/{_PAGE}')
@ -97,7 +97,7 @@ def logging_download():
def api_log_tail():
try:
cfg = load_config()
log_max_kb = cfg.get('free_radius', {}).get('general', {}).get('log_max_kb', 1024)
log_max_kb = cfg.get('radius', {}).get('general', {}).get('log_max_kb', 1024)
size_kb = os.path.getsize(RADIUS_LOG_FILE) / 1024
with open(RADIUS_LOG_FILE) as f:
lines = f.readlines()

View file

@ -128,6 +128,22 @@
"type": "raw_html",
"html": "%RADIUS_LOG_SUMMARY%"
},
{
"type": "button_row",
"justify": "space-between",
"items": [
{
"type": "button_ghost",
"action": "/action/radius/logging_download",
"text": "Download Log"
},
{
"type": "button_danger",
"formaction": "/action/radius/logging_clear",
"text": "Clear Log"
}
]
},
{
"type": "hr"
},
@ -155,23 +171,6 @@
]
}
]
},
{
"type": "button_row",
"justify": "space-between",
"items": [
{
"type": "button_ghost",
"action": "/action/radius/logging_download",
"text": "Download Log"
},
{
"type": "button_danger",
"action": "/action/radius/logging_clear",
"method": "post",
"text": "Clear Log"
}
]
}
]
}