90 lines
4.0 KiB
HTML
90 lines
4.0 KiB
HTML
{% extends "base.html" %}
|
|
{% set active_page = "" %}
|
|
{% block title %}HAProxy • Edit{% endblock %}
|
|
{% block head %}
|
|
{% endblock %}
|
|
{% block breadcrumb %}<nav aria-label="breadcrumb" class="mb-3"><ol class="breadcrumb mb-0"><li class="breadcrumb-item"><a href="{{ url_for('main.index') }}"><i class="bi bi-house"></i></a></li><li class="breadcrumb-item active" aria-current="page">Edytor</li></ol></nav>{% endblock %}
|
|
{% block content %}
|
|
<header class="header1" id="header1">
|
|
<a href="/home" style="text-decoration: none;">
|
|
<h3 style="font-size: 22px;" class="logo">
|
|
<i style="margin: 8px;" class="fas fa-globe"></i>Haproxy Configurator
|
|
</h3>
|
|
</a>
|
|
<a href="/home" class="menu-link">Home</a>
|
|
<a href="/" class="menu-link">Add Frontend & Backend</a>
|
|
<a href="/edit" class="menu-link">Edit HAProxy Config</a>
|
|
<a href="/logs" class="menu-link">Security Events</a>
|
|
<a href="/statistics" class="menu-link">Statictics</a>
|
|
<a href="http://{{ request.host.split(':')[0] }}:8404/stats" class="menu-link" target="_blank">HAProxy Stats</a>
|
|
|
|
<div class="custom-control custom-switch ml-auto">
|
|
<input type="checkbox" class="custom-control-input" id="darkModeSwitch">
|
|
<label class="custom-control-label" for="darkModeSwitch">Dark Mode</label>
|
|
</div>
|
|
|
|
|
|
<script>
|
|
// Function to toggle dark mode
|
|
function toggleDarkMode() {
|
|
const body = document.body;
|
|
body.classList.toggle('dark-mode');
|
|
|
|
// Save user's preference to localStorage
|
|
const isDarkMode = body.classList.contains('dark-mode');
|
|
localStorage.setItem('darkMode', isDarkMode); // Store the actual value
|
|
}
|
|
|
|
// Check if dark mode preference is saved in localStorage
|
|
const savedDarkMode = localStorage.getItem('darkMode');
|
|
if (savedDarkMode === 'true') {
|
|
document.body.classList.add('dark-mode');
|
|
}
|
|
|
|
// Add event listener to the switch
|
|
const darkModeSwitch = document.getElementById('darkModeSwitch');
|
|
darkModeSwitch.addEventListener('change', toggleDarkMode);
|
|
</script>
|
|
</header>
|
|
<div style=" border-radius: 5px;" id="editor_container" class="container mt-5">
|
|
<h3 style="color: grey; padding: 15px;" id="edit_conf" class="edit_conf">Edit HAProxy Config</h3>
|
|
<form method="POST">
|
|
<div class="form-group">
|
|
<label for="haproxy_config">Configuration:</label>
|
|
<textarea style="padding: 15px;" class="form-control" name="haproxy_config" rows="25" cols="120">{{ config_content }}</textarea>
|
|
</div>
|
|
<div style="padding-bottom: 20px;" class="form-group">
|
|
<input type="submit" class="btn btn-warning" id="save_check" name="save_check" value="Save & Check">
|
|
<input type="submit" class="btn btn-primary" name="save_reload" value="Save & Restart">
|
|
</div>
|
|
</form>
|
|
{% if check_output %}
|
|
<div style="padding-bottom: 15px;">
|
|
{% if 'Fatal errors' in check_output %}
|
|
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
|
<pre class="mt-3">{{ check_output }}</pre>
|
|
</div>
|
|
{% elif 'Warnings' in check_output %}
|
|
<div class="alert alert-warning alert-dismissible fade show" role="alert">
|
|
<pre class="mt-3">{{ check_output }}</pre>
|
|
</div>
|
|
{% elif 'error detected while parsing an' in check_output %}
|
|
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
|
<pre class="mt-3">{{ check_output }}</pre>
|
|
</div>
|
|
{% else %}
|
|
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
|
<pre class="mt-3">{{ check_output }}</pre>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
|
|
|
|
|
|
<!-- Add Bootstrap JS and jQuery scripts here (if needed) -->
|
|
<!-- You can get them from the official Bootstrap website or use CDN links -->
|
|
{% endblock %}
|
|
{% block scripts %}
|
|
{% endblock %} |