Development

This commit is contained in:
Matthew Grotke 2026-05-20 17:10:18 -04:00
parent 270856b391
commit 2bfa5ff29a
18 changed files with 814 additions and 565 deletions

View file

@ -2,7 +2,7 @@ from flask import Blueprint, request, redirect, flash
from auth import require_level
from config_utils import load_core, save_core, verify_core_hash, queued_msg
import sanitize
import validate
import validation as validate
bp = Blueprint('action_apply_inter_vlan', __name__)
@ -83,6 +83,11 @@ def add_inter_vlan():
core = load_core()
core.setdefault('inter_vlan_exceptions', []).append(entry)
errors = validate.validate_config(core)
if errors:
for msg in errors:
flash(msg, 'error')
return redirect(VIEW)
save_core(core)
flash(queued_msg('core apply'), 'success')
@ -107,6 +112,11 @@ def toggle_inter_vlan():
return redirect(VIEW)
items[idx]['enabled'] = not items[idx].get('enabled', True)
errors = validate.validate_config(core)
if errors:
for msg in errors:
flash(msg, 'error')
return redirect(VIEW)
save_core(core)
flash(queued_msg('core apply'), 'success')
@ -136,6 +146,11 @@ def edit_inter_vlan():
items[idx] = entry
items[idx]['enabled'] = request.form.get('enabled') == 'on'
errors = validate.validate_config(core)
if errors:
for msg in errors:
flash(msg, 'error')
return redirect(VIEW)
save_core(core)
flash(queued_msg('core apply'), 'success')
@ -160,6 +175,11 @@ def delete_inter_vlan():
return redirect(VIEW)
items.pop(idx)
errors = validate.validate_config(core)
if errors:
for msg in errors:
flash(msg, 'error')
return redirect(VIEW)
save_core(core)
flash(queued_msg('core apply'), 'success')