black_list.html 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <div class="w-full space-y-6">
  2. {% if domain_capped %}
  3. <div class="flex items-start gap-3 rounded-lg border border-amber-300 bg-amber-50 px-5 py-4 shadow-sm">
  4. <svg class="mt-0.5 h-5 w-5 flex-shrink-0 text-amber-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  5. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
  6. d="M12 9v2m0 4h.01M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/>
  7. </svg>
  8. <div>
  9. <p class="text-sm font-semibold text-amber-800">{{ _("Análisis parcial — límite de dominios activo") }}</p>
  10. <p class="mt-0.5 text-sm text-amber-700">
  11. {{ _("La blacklist contiene más de") }} <span class="font-bold">50</span> {{ _("dominios activos. Para evitar un alto consumo de recursos, la consulta se ha limitado a los primeros") }}
  12. <span class="font-bold">{{ domain_cap }}</span> {{ _("dominios. Es posible que algunos accesos bloqueados no aparezcan en este listado.") }}
  13. </p>
  14. </div>
  15. </div>
  16. {% endif %}
  17. <div class="bg-white rounded-lg shadow-md overflow-hidden">
  18. <div class="px-6 py-4 border-b border-gray-200 bg-gray-50 flex flex-col sm:flex-row justify-between items-center">
  19. <div class="mb-2 sm:mb-0">
  20. <span class="text-sm font-medium text-gray-600">
  21. {{ _("Total usuarios:") }}
  22. <span class="font-bold text-red-600">{{ pagination.total }}</span>
  23. </span>
  24. <span class="text-sm font-medium text-gray-600 ml-4">
  25. {{ _("Total peticiones:") }}
  26. <span class="font-bold text-red-600">{{ pagination.total_requests }}</span>
  27. </span>
  28. </div>
  29. <div class="flex items-center gap-2">
  30. <span class="text-sm font-medium text-gray-600 mr-2">{{ _("Mostrar:") }}</span>
  31. <select id="per_page" class="border border-gray-300 bg-white text-gray-800 rounded-md px-3 py-1.5 text-sm font-medium shadow-sm transition duration-150 ease-in-out focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
  32. onchange="window.location.href = updateQueryParam('per_page', this.value)">
  33. <option value="20" {% if pagination.per_page == 20 %}selected{% endif %}>20</option>
  34. <option value="50" {% if pagination.per_page == 50 %}selected{% endif %}>50</option>
  35. <option value="100" {% if pagination.per_page == 100 %}selected{% endif %}>100</option>
  36. </select>
  37. </div>
  38. </div>
  39. <div class="divide-y divide-gray-200">
  40. {% for user, items in results | groupby('usuario') %}
  41. {% set user_items = items | list %}
  42. {% set total_user = user_items | sum(attribute='count') %}
  43. <div class="user-group">
  44. <div class="px-6 py-4 bg-white">
  45. <div class="flex flex-col sm:flex-row sm:justify-between sm:items-center">
  46. <div class="flex items-center mb-2 sm:mb-0">
  47. <svg class="h-6 w-6 mr-3 text-blue-500 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  48. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"/>
  49. </svg>
  50. <h2 class="text-lg font-semibold text-gray-800">{{ user }}</h2>
  51. </div>
  52. <div class="flex-shrink-0">
  53. <span class="px-3 py-1 bg-red-100 text-red-800 text-xs font-bold rounded-full">
  54. {{ total_user }} {{ _("Intentos Bloqueados") }}
  55. </span>
  56. </div>
  57. </div>
  58. </div>
  59. <div class="px-6 py-4 border-t border-gray-200 bg-gray-50/50">
  60. <div class="space-y-2">
  61. {% for item in user_items %}
  62. <div class="flex items-center p-2 bg-white rounded-md shadow-sm">
  63. <p class="flex-grow font-mono text-sm text-gray-800 truncate pr-4">{{ item.domain }}</p>
  64. <span class="flex-shrink-0 px-2.5 py-0.5 text-xs font-bold text-red-800 bg-red-100 rounded-full">
  65. {{ item.count }}
  66. </span>
  67. </div>
  68. {% endfor %}
  69. </div>
  70. </div>
  71. </div>
  72. {% else %}
  73. <div class="px-6 py-12 text-center">
  74. <svg class="mx-auto h-12 w-12 text-gray-400" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true">
  75. <path vector-effect="non-scaling-stroke" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
  76. </svg>
  77. <h3 class="mt-2 text-sm font-medium text-gray-900">{{ _("No se encontraron registros") }}</h3>
  78. <p class="mt-1 text-sm text-gray-500">{{ _("No hay actividad en sitios bloqueados para mostrar.") }}</p>
  79. </div>
  80. {% endfor %}
  81. </div>
  82. <div class="px-6 py-4 border-t border-gray-200 bg-gray-50">
  83. <div class="flex flex-col sm:flex-row justify-between items-center">
  84. <span class="text-sm text-gray-600 mb-2 sm:mb-0">
  85. {{ _("Mostrando") }} {{ results | groupby('usuario') | list | length }} {{ _("usuarios en esta página.") }}
  86. </span>
  87. <div class="flex space-x-2">
  88. {% if pagination.page > 1 %}
  89. <a href="{{ url_for('logs.blacklist_logs', page=pagination.page-1, per_page=pagination.per_page) }}"
  90. class="px-4 py-2 bg-white border rounded-md shadow-sm text-sm font-medium text-gray-700 hover:bg-gray-50">
  91. {{ _("Anterior") }}
  92. </a>
  93. {% else %}
  94. <span class="px-4 py-2 bg-white border rounded-md shadow-sm text-sm font-medium text-gray-300 cursor-not-allowed select-none">
  95. {{ _("Anterior") }}
  96. </span>
  97. {% endif %}
  98. {% if pagination.page < pagination.total_pages %}
  99. <a href="{{ url_for('logs.blacklist_logs', page=pagination.page+1, per_page=pagination.per_page) }}"
  100. class="px-4 py-2 bg-white border rounded-md shadow-sm text-sm font-medium text-gray-700 hover:bg-gray-50">
  101. {{ _("Siguiente") }}
  102. </a>
  103. {% else %}
  104. <span class="px-4 py-2 bg-white border rounded-md shadow-sm text-sm font-medium text-gray-300 cursor-not-allowed select-none">
  105. {{ _("Siguiente") }}
  106. </span>
  107. {% endif %}
  108. </div>
  109. </div>
  110. </div>
  111. </div>
  112. </div>