Files
haproxy-dashboard/templates>/home.html
Mateusz Gruszczyński 3c8b9b062d redactor
2025-11-01 21:25:53 +01:00

153 lines
5.1 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HAProxy Home</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<style>
/* Custom CSS for the header */
header {
background-color: #f2f2f2;
padding: 20px;
display: flex;
padding-left: 100px;
align-items: center;
}
.logo {
width: 300px; /* Adjust the width as needed */
height: auto;
}
.menu-link {
text-decoration: none;
padding: 10px 20px;
color: #333;
font-weight: bold;
}
.menu-link:hover {
background-color: #3B444B;
color: white;
text-decoration: none;
}
#summary_container{
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}
/* Custom CSS for dark mode */
.dark-mode {
background-color: #121B2E;
color: white;
}
.dark-mode .header1{
background-color: #25354e;
color: white;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}
.dark-mode .menu-link{
text-decoration: none;
padding: 10px 20px;
color: white;
font-weight: bold;
}
.dark-mode .logo {
color: #2bb9c7;
font-weight: bold;
}
.dark-mode .fas-fa-globe{
color: #2bb9c7;
}
.dark-mode .menu-link:hover{
text-decoration: none;
padding: 10px 20px;
color: #2bb9c7;
font-weight: bold;
}
.dark-mode #summary_container{
box-shadow: 0 0 15px 5px rgba(43, 185, 199, 0.05);
border: none;
}
</style>
</head>
<body>
<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" >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>
</header>
<div style=" border-radius: 5px; padding: 40px;" id="summary_container" class="container mt-5">
<h3 style="margin-bottom: 20px;" class="mt-4">Welcome to Your HAProxy Configurator. Here's A Short Summary:</h3>
<p class="lead"><i style="margin: 8px;" class="fas fa-globe"></i> <strong>{{ frontend_count }}</strong> frontends</p>
<p class="lead"><i style="margin-right: 8px;" class="fas fa-sitemap"></i> <strong>{{ backend_count }}</strong> backends</p>
<p class="lead"><i style="margin: 8px;" class="fas fa-user-lock"></i> <strong>{{ acl_count }}</strong> acl's</p>
<p class="lead"><i style="margin: 8px;" class="fas fa-code"></i> <strong>{{ layer7_count }}</strong> layer7(mode http) loadbalanced frontends</p>
<p class="lead"><i style="margin: 8px;" class="fas fa-network-wired"></i> <strong>{{ layer4_count }}</strong> layer4(mode tcp)loadbalanced frontends</p>
<div class="mt-4">
<a href="/" class="btn btn-primary"><i style="margin: 8px;" class="fas fa-plus"></i>Add New Frontend/Backend</a>
</div>
</div>
<!-- Add Bootstrap JS and jQuery links here (if needed) -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<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>
</body>
</html>