reports_pdf.html 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <!DOCTYPE html>
  2. <html lang="{{ get_locale() }}">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>{{ _("Reportes SquidStats -") }} {{ selected_date.isoformat() }}</title>
  7. <style>
  8. body { font-family: Arial, Helvetica, sans-serif; color: #1f2937; margin: 24px; }
  9. h1 { font-size: 22px; margin-bottom: 8px; }
  10. h2 { font-size: 18px; margin-top: 24px; margin-bottom: 8px; }
  11. .meta { font-size: 12px; opacity: .8; margin-bottom: 16px; }
  12. .box { border: 1px solid #e5e7eb; border-radius: 8px; padding: 14px; margin-bottom: 12px; }
  13. .table { width: 100%; border-collapse: collapse; margin-top: 8px; }
  14. .table th, .table td { border: 1px solid #d1d5db; padding: 8px; text-align: left; }
  15. .table th { background: #f3f4f6; }
  16. </style>
  17. </head>
  18. <body>
  19. <h1>{{ _("Reportes SquidStats") }}</h1>
  20. <div class="meta">{{ _("Fecha del reporte:") }} {{ selected_date.isoformat() }} {{ _("- Generado:") }} {{ generated_at }}</div>
  21. <div class="box">
  22. <h2>{{ _("Resumen General") }}</h2>
  23. <p>{{ _("Total usuarios:") }} {{ metrics.total_stats.total_users | default(0) }}</p>
  24. <p>{{ _("Total solicitudes:") }} {{ metrics.total_stats.total_requests | default(0) }}</p>
  25. <p>{{ _("Datos consumidos (MB):") }} {{ ((metrics.total_stats.total_data_transmitted | default(0)) / 1048576) | round(2) }}</p>
  26. <p>{{ _("Tasa de éxito HTTP:") }} {{ metrics.successful_request_rate | default(0) | round(1) }}%</p>
  27. <p>{{ _("Errores HTTP:") }} {{ metrics.error_requests | default(0) }} ({{ metrics.error_request_rate | default(0) | round(1) }}%)</p>
  28. <p>{{ _("Accesos bloqueados:") }} {{ metrics.blocked_requests | default(0) }} ({{ metrics.blocked_request_rate | default(0) | round(1) }}%)</p>
  29. <p>{{ _("Destinos únicos:") }} {{ metrics.unique_domains | default(0) }}</p>
  30. <p>{{ _("Hora pico:") }} {{ "%02d:00" | format(metrics.peak_hour.hour | default(0)) }}</p>
  31. </div>
  32. <div class="box">
  33. <h2>{{ _("Top usuarios por actividad") }}</h2>
  34. <table class="table">
  35. <thead>
  36. <tr><th>{{ _("Usuario") }}</th><th>{{ _("Visitas") }}</th></tr>
  37. </thead>
  38. <tbody>
  39. {% for item in metrics.top_users_by_activity %}
  40. <tr>
  41. <td>{{ item.username }}</td>
  42. <td>{{ item.total_visits }}</td>
  43. </tr>
  44. {% endfor %}
  45. </tbody>
  46. </table>
  47. </div>
  48. <div class="box">
  49. <h2>{{ _("Top URLs por consumo de datos") }}</h2>
  50. <table class="table">
  51. <thead>
  52. <tr><th>{{ _("URL") }}</th><th>{{ _("Datos (MB)") }}</th></tr>
  53. </thead>
  54. <tbody>
  55. {% for item in metrics.top_pages_by_data %}
  56. <tr>
  57. <td>{{ item.url }}</td>
  58. <td>{{ ((item.total_data_bytes | default(0)) / 1048576) | round(2) }}</td>
  59. </tr>
  60. {% endfor %}
  61. </tbody>
  62. </table>
  63. </div>
  64. <div class="box">
  65. <h2>{{ _("Top dominios de destino") }}</h2>
  66. <table class="table">
  67. <thead>
  68. <tr><th>{{ _("Dominio") }}</th><th>{{ _("Peticiones") }}</th><th>{{ _("Datos (MB)") }}</th></tr>
  69. </thead>
  70. <tbody>
  71. {% for item in metrics.top_domains %}
  72. <tr>
  73. <td>{{ item.domain }}</td>
  74. <td>{{ item.total_requests }}</td>
  75. <td>{{ ((item.total_data_bytes | default(0)) / 1048576) | round(2) }}</td>
  76. </tr>
  77. {% else %}
  78. <tr><td colspan="3">{{ _("No hay destinos identificables para esta fecha.") }}</td></tr>
  79. {% endfor %}
  80. </tbody>
  81. </table>
  82. </div>
  83. <div class="box">
  84. <h2>{{ _("Distribución de códigos HTTP") }}</h2>
  85. <table class="table">
  86. <thead>
  87. <tr><th>{{ _("Código") }}</th><th>{{ _("Conteo") }}</th></tr>
  88. </thead>
  89. <tbody>
  90. {% for code in metrics.http_response_distribution_chart.labels %}
  91. <tr>
  92. <td>{{ code }}</td>
  93. <td>{{ metrics.http_response_distribution_chart.data[loop.index0] }}</td>
  94. </tr>
  95. {% endfor %}
  96. </tbody>
  97. </table>
  98. </div>
  99. </body>
  100. </html>