acls.html 5.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. {% extends "base.html" %}
  2. {% block content %}
  3. <div class="space-y-6">
  4. <div class="bg-white rounded-lg shadow-lg p-6">
  5. <div class="flex justify-between items-center mb-6">
  6. <h2 class="text-2xl font-bold text-gray-800">Gestión de ACLs</h2>
  7. <button onclick="toggleAddForm()" class="bg-green-500 hover:bg-green-600 text-white px-4 py-2 rounded-lg transition-colors">
  8. <i class="fas fa-plus mr-2"></i>Agregar ACL
  9. </button>
  10. </div>
  11. <!-- Add ACL Form -->
  12. <div id="addAclForm" class="hidden bg-gray-50 p-6 rounded-lg mb-6">
  13. <h3 class="text-lg font-semibold mb-4">Agregar Nueva ACL</h3>
  14. <form method="POST" action="/admin/acls/add" class="grid grid-cols-1 md:grid-cols-3 gap-4">
  15. <div>
  16. <label class="block text-sm font-medium text-gray-700 mb-2">Nombre:</label>
  17. <input type="text" name="name" required class="w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500">
  18. </div>
  19. <div>
  20. <label class="block text-sm font-medium text-gray-700 mb-2">Tipo:</label>
  21. <select name="type" required class="w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500">
  22. <option value="src">src (IP origen)</option>
  23. <option value="dst">dst (IP destino)</option>
  24. <option value="dstdomain">dstdomain (Dominio destino)</option>
  25. <option value="port">port (Puerto)</option>
  26. <option value="time">time (Tiempo)</option>
  27. <option value="method">method (Método HTTP)</option>
  28. <option value="proxy_auth">proxy_auth (Autenticación)</option>
  29. <option value="maxconn">maxconn (Conexiones máximas)</option>
  30. </select>
  31. </div>
  32. <div>
  33. <label class="block text-sm font-medium text-gray-700 mb-2">Valor:</label>
  34. <input type="text" name="value" required class="w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500">
  35. </div>
  36. <div class="md:col-span-3 flex space-x-4">
  37. <button type="submit" class="bg-green-500 hover:bg-green-600 text-white px-6 py-2 rounded-lg transition-colors">
  38. <i class="fas fa-save mr-2"></i>Guardar ACL
  39. </button>
  40. <button type="button" onclick="toggleAddForm()" class="bg-gray-500 hover:bg-gray-600 text-white px-6 py-2 rounded-lg transition-colors">
  41. <i class="fas fa-times mr-2"></i>Cancelar
  42. </button>
  43. </div>
  44. </form>
  45. </div>
  46. <!-- ACLs List -->
  47. <div class="overflow-x-auto">
  48. <table class="w-full table-auto">
  49. <thead class="bg-gray-50">
  50. <tr>
  51. <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Nombre</th>
  52. <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Tipo</th>
  53. <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Valor</th>
  54. <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Acciones</th>
  55. </tr>
  56. </thead>
  57. <tbody class="bg-white divide-y divide-gray-200">
  58. {% for acl in acls %}
  59. <tr class="hover:bg-gray-50">
  60. <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">{{ acl.name }}</td>
  61. <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
  62. <span class="inline-flex px-2 py-1 text-xs font-semibold rounded-full bg-blue-100 text-blue-800">
  63. {{ acl.type }}
  64. </span>
  65. </td>
  66. <td class="px-6 py-4 text-sm text-gray-500 max-w-xs truncate">{{ acl.value }}</td>
  67. <td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
  68. <button class="text-blue-600 hover:text-blue-900 mr-3">
  69. <i class="fas fa-edit"></i>
  70. </button>
  71. <button class="text-red-600 hover:text-red-900">
  72. <i class="fas fa-trash"></i>
  73. </button>
  74. </td>
  75. </tr>
  76. {% endfor %}
  77. </tbody>
  78. </table>
  79. </div>
  80. </div>
  81. </div>
  82. <script>
  83. function toggleAddForm() {
  84. const form = document.getElementById('addAclForm');
  85. form.classList.toggle('hidden');
  86. }
  87. </script>
  88. {% endblock %}