new_functions_and_fixes #1
@@ -43,7 +43,7 @@ def reload_haproxy():
|
||||
@requires_auth
|
||||
def index():
|
||||
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_port = request.form['frontend_port']
|
||||
frontend_hostname = request.form.get('frontend_hostname', '').strip()
|
||||
@@ -152,9 +152,8 @@ def index():
|
||||
acl_action = ''
|
||||
acl_backend_name = ''
|
||||
|
||||
# ===== GENERUJ FRONTEND NAME ZAMIAST PRZYJMOWAĆ OD USERA =====
|
||||
# frontend_name będzie generowany w haproxy_config.py
|
||||
frontend_name = None # Będzie wygenerowany automatycznie
|
||||
# Frontend name (None - will be generated)
|
||||
frontend_name = None
|
||||
|
||||
# Call update_haproxy_config
|
||||
message = update_haproxy_config(
|
||||
@@ -210,9 +209,25 @@ def index():
|
||||
custom_acl_redirect_url=custom_acl_redirect_url
|
||||
)
|
||||
|
||||
# ===== RELOAD HAPROXY =====
|
||||
message_type = "success" if "successfully" in message.lower() else "danger"
|
||||
# ===== DETERMINE MESSAGE TYPE =====
|
||||
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":
|
||||
reload_ok, reload_msg = reload_haproxy()
|
||||
if reload_ok:
|
||||
@@ -225,8 +240,8 @@ def index():
|
||||
return render_template('index.html',
|
||||
message=message,
|
||||
message_type=message_type)
|
||||
|
||||
# GET request - display stats
|
||||
|
||||
# GET request - display stats
|
||||
frontend_count, backend_count, acl_count, layer7_count, layer4_count = count_frontends_and_backends()
|
||||
|
||||
return render_template('index.html',
|
||||
|
||||
Reference in New Issue
Block a user