Development
This commit is contained in:
parent
ead6926bf9
commit
096904c723
4 changed files with 13 additions and 8 deletions
|
|
@ -648,6 +648,8 @@ def build_field(item, tokens):
|
|||
|
||||
if input_type == 'checkbox':
|
||||
checked = 'checked' if value.lower() in ('true', '1', 'yes') else ''
|
||||
disabled_raw = apply_tokens(str(item.get('disabled', '')), tokens)
|
||||
disabled = ' disabled' if disabled_raw and disabled_raw not in ('false', '0') else ''
|
||||
cb_label = item.get('checkbox_label')
|
||||
if cb_label:
|
||||
label_html = f'<label class="form-label">{label}</label>' if label else ''
|
||||
|
|
@ -655,14 +657,14 @@ def build_field(item, tokens):
|
|||
'<div class="form-group">'
|
||||
f'{label_html}'
|
||||
'<label class="form-checkbox-row">'
|
||||
f'<input type="checkbox" name="{name}" {checked} class="form-checkbox"/>'
|
||||
f'<input type="checkbox" name="{name}" {checked}{disabled} class="form-checkbox"/>'
|
||||
f' <span class="form-checkbox-label">{e(cb_label)}</span>'
|
||||
f'</label>{hint_html}</div>'
|
||||
)
|
||||
return (
|
||||
'<div class="form-group">'
|
||||
'<label class="form-label">'
|
||||
f'<input type="checkbox" name="{name}" {checked} class="form-checkbox"/> {label}'
|
||||
f'<input type="checkbox" name="{name}" {checked}{disabled} class="form-checkbox"/> {label}'
|
||||
f'</label>{hint_html}</div>'
|
||||
)
|
||||
|
||||
|
|
@ -693,7 +695,7 @@ def build_field(item, tokens):
|
|||
options = []
|
||||
current = apply_tokens(item.get('value', ''), tokens)
|
||||
opts_html = ''.join(
|
||||
f'<option value="{e(o["value"])}"{" selected" if o["value"] == current else ""}>{e(o["label"])}</option>'
|
||||
f'<option value="{e(o["value"])}"{" selected" if o["value"] == current else ""}{" disabled" if o.get("disabled") else ""}>{e(o["label"])}</option>'
|
||||
for o in options
|
||||
)
|
||||
validate_raw = item.get('validate', '')
|
||||
|
|
|
|||
|
|
@ -353,6 +353,7 @@
|
|||
"label": "%RESTRICTED_VLAN_LABEL%",
|
||||
"name": "restricted_vlan",
|
||||
"input_type": "checkbox",
|
||||
"disabled": "%RESTRICTED_VLAN_DISABLED%",
|
||||
"hint": "Block devices on this VLAN from communicating with the Internet. Block all LAN traffic as well (except where Inter-VLAN-Exception rules allow)."
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ def collect_tokens(cfg):
|
|||
tokens['EXISTING_VLAN_NAMES_JSON'] = json.dumps([v.get('name') for v in vlans])
|
||||
tokens['RADIUS_DEFAULT_VLAN'] = f'"{dv["name"]}" (VLAN {dv["vlan_id"]})' if dv else 'none set'
|
||||
tokens['RESTRICTED_VLAN_LABEL'] = 'Restricted VLAN' if PRO_LICENSE else 'Restricted VLAN (PRO FEATURE)'
|
||||
tokens['RESTRICTED_VLAN_DISABLED'] = '' if PRO_LICENSE else 'true'
|
||||
tokens['BLOCKLIST_NAME_OPTIONS'] = json.dumps([
|
||||
{'value': bl.get('name', ''), 'label': bl.get('description', bl.get('name', ''))}
|
||||
for bl in cfg.get('dns_blocking', {}).get('blocklists', [])
|
||||
|
|
|
|||
|
|
@ -70,10 +70,11 @@ def collect_tokens(cfg):
|
|||
tokens['RADIUS_MAC_FORMAT'] = fr_opts.get('mac_format', 'aabbccddeeff')
|
||||
tokens['RADIUS_AUTH_MODE'] = fr_opts.get('auth_mode', 'mab')
|
||||
pro_suffix = '' if PRO_LICENSE else ' (PRO REQUIRED)'
|
||||
pro_disabled = not PRO_LICENSE
|
||||
tokens['RADIUS_AUTH_MODE_OPTIONS'] = json.dumps([
|
||||
{'value': 'mab', 'label': 'MAC Authentication Bypass (MAB)'},
|
||||
{'value': 'eap_password', 'label': f'802.1X - Client Username/Password{pro_suffix}'},
|
||||
{'value': 'eap_credential', 'label': f'802.1X - Client Certificate{pro_suffix}'},
|
||||
{'value': 'eap_password', 'label': f'802.1X - Client Username/Password{pro_suffix}', 'disabled': pro_disabled},
|
||||
{'value': 'eap_credential', 'label': f'802.1X - Client Certificate{pro_suffix}', 'disabled': pro_disabled},
|
||||
])
|
||||
tokens['RADIUS_APPLY_TO'] = fr_opts.get('apply_to', 'all')
|
||||
tokens['RADIUS_AP_IPS'] = json.dumps(fr_opts.get('ap_ips', []))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue