| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- <!DOCTYPE html>
- <html lang="es">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>{% block title %}Administrador Squid Proxy{% endblock %}</title>
- <script src="https://cdn.tailwindcss.com"></script>
- <script src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js" defer></script>
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
- </head>
- <body class="bg-gray-50 min-h-screen">
- <!-- Navigation -->
- <nav class="bg-blue-600 text-white shadow-lg">
- <div class="max-w-7xl mx-auto px-4">
- <div class="flex justify-between items-center py-4">
- <div class="flex items-center space-x-4">
- <i class="fas fa-server text-2xl"></i>
- <h1 class="text-xl font-bold">Administrador Squid Proxy</h1>
- </div>
- <div class="flex space-x-4">
- <button onclick="reloadSquid()" class="bg-green-500 hover:bg-green-600 px-4 py-2 rounded-lg transition-colors">
- <i class="fas fa-sync-alt mr-2"></i>Recargar
- </button>
- <button onclick="restartSquid()" class="bg-red-500 hover:bg-red-600 px-4 py-2 rounded-lg transition-colors">
- <i class="fas fa-power-off mr-2"></i>Reiniciar
- </button>
- </div>
- </div>
- </div>
- </nav>
- <!-- Sidebar -->
- <div class="flex">
- <aside class="w-64 bg-white shadow-lg min-h-screen">
- <nav class="mt-8">
- <div class="px-4 space-y-2">
- <a href="{{ url_for('index') }}" class="flex items-center px-4 py-3 text-gray-700 hover:bg-blue-50 hover:text-blue-600 rounded-lg transition-colors">
- <i class="fas fa-home mr-3"></i>Dashboard
- </a>
- <a href="{{ url_for('view_config') }}" class="flex items-center px-4 py-3 text-gray-700 hover:bg-blue-50 hover:text-blue-600 rounded-lg transition-colors">
- <i class="fas fa-file-code mr-3"></i>Configuración
- </a>
- <a href="{{ url_for('manage_acls') }}" class="flex items-center px-4 py-3 text-gray-700 hover:bg-blue-50 hover:text-blue-600 rounded-lg transition-colors">
- <i class="fas fa-shield-alt mr-3"></i>ACLs
- </a>
- <a href="{{ url_for('manage_delay_pools') }}" class="flex items-center px-4 py-3 text-gray-700 hover:bg-blue-50 hover:text-blue-600 rounded-lg transition-colors">
- <i class="fas fa-tachometer-alt mr-3"></i>Delay Pools
- </a>
- <a href="{{ url_for('manage_http_access') }}" class="flex items-center px-4 py-3 text-gray-700 hover:bg-blue-50 hover:text-blue-600 rounded-lg transition-colors">
- <i class="fas fa-key mr-3"></i>Acceso HTTP
- </a>
- <a href="{{ url_for('view_logs') }}" class="flex items-center px-4 py-3 text-gray-700 hover:bg-blue-50 hover:text-blue-600 rounded-lg transition-colors">
- <i class="fas fa-file-alt mr-3"></i>Logs
- </a>
- </div>
- </nav>
- </aside>
- <!-- Main Content -->
- <main class="flex-1 p-8">
- <!-- Flash Messages -->
- {% with messages = get_flashed_messages(with_categories=true) %}
- {% if messages %}
- <div class="mb-6">
- {% for category, message in messages %}
- <div class="alert alert-{{ 'success' if category == 'success' else 'error' }} p-4 rounded-lg mb-4 {% if category == 'success' %}bg-green-100 text-green-700 border border-green-300{% else %}bg-red-100 text-red-700 border border-red-300{% endif %}">
- <i class="fas fa-{% if category == 'success' %}check-circle{% else %}exclamation-triangle{% endif %} mr-2"></i>
- {{ message }}
- </div>
- {% endfor %}
- </div>
- {% endif %}
- {% endwith %}
- {% block content %}{% endblock %}
- </main>
- </div>
- <script>
- async function reloadSquid() {
- try {
- const response = await fetch('/api/reload-squid', { method: 'POST' });
- const data = await response.json();
-
- if (data.status === 'success') {
- showNotification(data.message, 'success');
- } else {
- showNotification(data.message, 'error');
- }
- } catch (error) {
- showNotification('Error al recargar Squid', 'error');
- }
- }
- async function restartSquid() {
- if (confirm('¿Está seguro de que desea reiniciar Squid? Esto interrumpirá temporalmente el servicio.')) {
- try {
- const response = await fetch('/api/restart-squid', { method: 'POST' });
- const data = await response.json();
-
- if (data.status === 'success') {
- showNotification(data.message, 'success');
- } else {
- showNotification(data.message, 'error');
- }
- } catch (error) {
- showNotification('Error al reiniciar Squid', 'error');
- }
- }
- }
- function showNotification(message, type) {
- const notification = document.createElement('div');
- notification.className = `fixed top-4 right-4 p-4 rounded-lg shadow-lg z-50 ${
- type === 'success' ? 'bg-green-500 text-white' : 'bg-red-500 text-white'
- }`;
- notification.innerHTML = `
- <div class="flex items-center">
- <i class="fas fa-${type === 'success' ? 'check-circle' : 'exclamation-triangle'} mr-2"></i>
- ${message}
- </div>
- `;
-
- document.body.appendChild(notification);
-
- setTimeout(() => {
- notification.remove();
- }, 5000);
- }
- </script>
- </body>
- </html>
|