195 lines
8.6 KiB
HTML
195 lines
8.6 KiB
HTML
{% set active_page = active_page|default('') %}
|
|
<!doctype html>
|
|
<html lang="en" data-bs-theme="dark">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>{% block title %}HAProxy Configurator{% endblock %}</title>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
|
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}">
|
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/edit.css') }}">
|
|
{% block head %}{% endblock %}
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
|
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css" rel="stylesheet">
|
|
|
|
<style>
|
|
.navbar-brand {
|
|
font-weight: 700;
|
|
font-size: 1.25rem;
|
|
}
|
|
.user-menu {
|
|
min-width: 200px;
|
|
}
|
|
.menu-divider {
|
|
margin: 0.5rem 0;
|
|
border-top: 1px solid rgba(255, 255, 255, 0.1);
|
|
}
|
|
</style>
|
|
</head>
|
|
<body class="bg-body">
|
|
<!-- NAVBAR -->
|
|
<header class="navbar navbar-expand-lg navbar-dark bg-dark border-bottom border-secondary">
|
|
<div class="container-fluid px-4">
|
|
<!-- Logo -->
|
|
<a href="{% if session.get('user_id') %}{{ url_for('main.index') }}{% else %}{{ url_for('auth.login') }}{% endif %}" class="navbar-brand d-flex align-items-center gap-2">
|
|
<i class="fas fa-globe"></i>
|
|
<span>HAProxy Manager</span>
|
|
</a>
|
|
|
|
<!-- Toggle Button (Mobile) -->
|
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
|
<span class="navbar-toggler-icon"></span>
|
|
</button>
|
|
|
|
<!-- Navigation Menu -->
|
|
<div class="collapse navbar-collapse" id="navbarNav">
|
|
{% if session.get('user_id') %}
|
|
<nav class="navbar-nav ms-auto d-flex align-items-center gap-3">
|
|
<!-- Menu Links -->
|
|
<a href="{{ url_for('main.index') }}" class="nav-link {{ 'active' if request.path == '/' or request.path.startswith('/home') else '' }}">
|
|
<i class="bi bi-speedometer2"></i> Dashboard
|
|
</a>
|
|
<a href="{{ url_for('main.index') }}" class="nav-link {{ 'active' if request.path.startswith('/add') else '' }}">
|
|
<i class="bi bi-plus-circle"></i> Add VHost
|
|
</a>
|
|
<a href="{{ url_for('edit.edit_haproxy_config') }}" class="nav-link {{ 'active' if request.path.startswith('/edit') else '' }}">
|
|
<i class="bi bi-pencil-square"></i> Edit Config
|
|
</a>
|
|
<a href="{{ url_for('display_logs') }}" class="nav-link {{ 'active' if request.path.startswith('/logs') else '' }}">
|
|
<i class="bi bi-shield-lock"></i> Logs
|
|
</a>
|
|
<a href="{{ url_for('display_haproxy_stats') }}" class="nav-link {{ 'active' if request.path.startswith('/statistics') else '' }}">
|
|
<i class="bi bi-graph-up-arrow"></i> Stats
|
|
</a>
|
|
<a href="http://{{ request.host.split(':')[0] }}:8404/stats" class="nav-link" target="_blank" rel="noopener">
|
|
<i class="bi bi-box-arrow-up-right"></i> HAProxy Stats
|
|
</a>
|
|
|
|
<!-- User Dropdown Menu -->
|
|
<div class="nav-item dropdown">
|
|
<button class="nav-link dropdown-toggle btn btn-link text-decoration-none d-flex align-items-center gap-2" id="userMenu" type="button" data-bs-toggle="dropdown" aria-expanded="false">
|
|
<i class="bi bi-person-circle"></i>
|
|
<span class="d-none d-lg-inline">{{ session.get('username', 'User') }}</span>
|
|
</button>
|
|
<ul class="dropdown-menu dropdown-menu-dark dropdown-menu-end user-menu" aria-labelledby="userMenu">
|
|
<li>
|
|
<a class="dropdown-item" href="#" disabled>
|
|
<i class="bi bi-person"></i> {{ session.get('username', 'User') }}
|
|
</a>
|
|
</li>
|
|
|
|
<li><hr class="dropdown-divider"></li>
|
|
|
|
<!-- Admin Only Menu Items -->
|
|
{% if session.get('is_admin') %}
|
|
<li>
|
|
<a class="dropdown-item" href="{{ url_for('main.index') }}">
|
|
<i class="bi bi-people"></i> User Management
|
|
</a>
|
|
</li>
|
|
<li>
|
|
<a class="dropdown-item" href="{{ url_for('main.index') }}">
|
|
<i class="bi bi-shield-check"></i> Certificates
|
|
</a>
|
|
</li>
|
|
<li><hr class="dropdown-divider"></li>
|
|
{% endif %}
|
|
|
|
<li>
|
|
<a class="dropdown-item text-warning" href="{{ url_for('auth.logout') }}">
|
|
<i class="bi bi-box-arrow-right"></i> Logout
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</nav>
|
|
{% else %}
|
|
<!-- Login Link (when not authenticated) -->
|
|
<nav class="navbar-nav ms-auto">
|
|
<a href="{{ url_for('auth.login') }}" class="nav-link">
|
|
<i class="bi bi-box-arrow-in-right"></i> Login
|
|
</a>
|
|
</nav>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
<!-- MAIN CONTENT -->
|
|
<main class="container-fluid py-4">
|
|
{% with messages = get_flashed_messages(with_categories=true) %}
|
|
{% if messages %}
|
|
{% for category, message in messages %}
|
|
<div class="alert alert-{{ category }} alert-dismissible fade show" role="alert">
|
|
<i class="bi bi-{{ 'check-circle' if category == 'success' else 'exclamation-circle' if category == 'danger' else 'info-circle' }}"></i>
|
|
{{ message }}
|
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
|
</div>
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% endwith %}
|
|
|
|
<!-- Breadcrumb -->
|
|
{% block breadcrumb %}{% endblock %}
|
|
|
|
<!-- Toast Container -->
|
|
<div id="toast-stack" class="toast-container position-fixed top-0 end-0 p-3"></div>
|
|
|
|
<!-- Page Content -->
|
|
{% block content %}{% endblock %}
|
|
</main>
|
|
|
|
<!-- FOOTER -->
|
|
<footer class="app-footer border-top border-secondary bg-dark mt-5">
|
|
<div class="container-fluid px-4 py-3">
|
|
<div class="row align-items-center">
|
|
<div class="col-md-6 small text-muted">
|
|
<p class="mb-2">
|
|
© 2025 <strong>HAProxy Configurator & Manager</strong>
|
|
</p>
|
|
<p class="mb-0">
|
|
<i class="bi bi-info-circle"></i>
|
|
Powerful web-based HAProxy configuration management system
|
|
</p>
|
|
</div>
|
|
<div class="col-md-6 text-md-end small text-muted text-start">
|
|
<p class="mb-2">
|
|
<i class="bi bi-code-slash"></i>
|
|
Built with <strong>Flask</strong> + <strong>SQLAlchemy</strong> + <strong>Bootstrap 5</strong>
|
|
</p>
|
|
<p class="mb-0">
|
|
Based on: <a href="https://github.com/alonz22/haproxy-dashboard" target="_blank" class="text-decoration-none" rel="noopener">Original Project</a>
|
|
| Maintained by <strong>@linuxiarz.pl</strong>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
|
|
<!-- SCRIPTS -->
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
|
|
<script src="{{ url_for('static', filename='js/main.js') }}"></script>
|
|
{% block scripts %}{% endblock %}
|
|
{% block page_js %}{% endblock %}
|
|
|
|
<script>
|
|
/**
|
|
* Auto-dismiss alerts after 5 seconds
|
|
*/
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
const alerts = document.querySelectorAll('.alert:not(.alert-permanent)');
|
|
alerts.forEach(alert => {
|
|
setTimeout(() => {
|
|
const bsAlert = new bootstrap.Alert(alert);
|
|
bsAlert.close();
|
|
}, 5000);
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|