new options
This commit is contained in:
@@ -43,7 +43,7 @@ def reload_haproxy():
|
|||||||
@requires_auth
|
@requires_auth
|
||||||
def index():
|
def index():
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
# Frontend IP i port (używane do generowania nazwy frontendu)
|
# Frontend IP i port
|
||||||
frontend_ip = request.form['frontend_ip']
|
frontend_ip = request.form['frontend_ip']
|
||||||
frontend_port = request.form['frontend_port']
|
frontend_port = request.form['frontend_port']
|
||||||
frontend_hostname = request.form.get('frontend_hostname', '').strip()
|
frontend_hostname = request.form.get('frontend_hostname', '').strip()
|
||||||
@@ -152,9 +152,8 @@ def index():
|
|||||||
acl_action = ''
|
acl_action = ''
|
||||||
acl_backend_name = ''
|
acl_backend_name = ''
|
||||||
|
|
||||||
# ===== GENERUJ FRONTEND NAME ZAMIAST PRZYJMOWAĆ OD USERA =====
|
# Frontend name (None - will be generated)
|
||||||
# frontend_name będzie generowany w haproxy_config.py
|
frontend_name = None
|
||||||
frontend_name = None # Będzie wygenerowany automatycznie
|
|
||||||
|
|
||||||
# Call update_haproxy_config
|
# Call update_haproxy_config
|
||||||
message = update_haproxy_config(
|
message = update_haproxy_config(
|
||||||
@@ -210,9 +209,25 @@ def index():
|
|||||||
custom_acl_redirect_url=custom_acl_redirect_url
|
custom_acl_redirect_url=custom_acl_redirect_url
|
||||||
)
|
)
|
||||||
|
|
||||||
# ===== RELOAD HAPROXY =====
|
# ===== DETERMINE MESSAGE TYPE =====
|
||||||
message_type = "success" if "successfully" in message.lower() else "danger"
|
message_type = "success" # Default
|
||||||
|
|
||||||
|
# Check for ERROR conditions
|
||||||
|
if "error" in message.lower():
|
||||||
|
message_type = "danger"
|
||||||
|
elif "failed" in message.lower():
|
||||||
|
message_type = "danger"
|
||||||
|
elif "already exists" in message.lower():
|
||||||
|
message_type = "danger"
|
||||||
|
elif "cannot add" in message.lower():
|
||||||
|
message_type = "danger"
|
||||||
|
# SUCCESS conditions
|
||||||
|
elif "configuration updated successfully" in message.lower():
|
||||||
|
message_type = "success"
|
||||||
|
elif "backend added to existing" in message.lower():
|
||||||
|
message_type = "success"
|
||||||
|
|
||||||
|
# ===== RELOAD HAPROXY (JEŚLI SUCCESS) =====
|
||||||
if message_type == "success":
|
if message_type == "success":
|
||||||
reload_ok, reload_msg = reload_haproxy()
|
reload_ok, reload_msg = reload_haproxy()
|
||||||
if reload_ok:
|
if reload_ok:
|
||||||
|
|||||||
Reference in New Issue
Block a user