scan_report.twig 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>OtAdmin Scan Report</title>
  5. <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.23/css/jquery.dataTables.css">
  6. <script type="text/javascript" charset="utf8" src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
  7. <script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.23/js/jquery.dataTables.js"></script>
  8. <script type="text/javascript" charset="utf8" src="https://cdn.jsdelivr.net/npm/chart.js@2.8.0"></script>
  9. <style>
  10. body {
  11. margin: 0 10%;
  12. }
  13. .summary, .details {
  14. margin: 24px 0;
  15. }
  16. .chart-div {
  17. height: 400px;
  18. }
  19. </style>
  20. </head>
  21. <body>
  22. <h1>OtAdmin Scan Report</h1>
  23. <div class="summary">
  24. <div class="chart-div">
  25. <canvas id="chart_stats" width="400" height="400"></canvas>
  26. </div>
  27. </div>
  28. <div class="details">
  29. <table id="results" class="display">
  30. <thead>
  31. <tr>
  32. <th>Organization Id</th>
  33. <th>Status</th>
  34. <th>Root uid</th>
  35. <th>Site's title</th>
  36. <th>Url</th>
  37. <th>Warnings</th>
  38. </tr>
  39. </thead>
  40. <tbody>
  41. {% for status in scan.results %}
  42. <tr>
  43. <td>{{ status.organizationId }}</td>
  44. <td>{{ status.statusLabel }}</td>
  45. {% if status.statusCode > 0 %}
  46. <td>{{ status.siteInfos.rootUid }}</td>
  47. <td>{{ status.siteInfos.siteTitle }}</td>
  48. <td>{{ status.siteInfos.baseUrl }}</td>
  49. {% if status.useWarnings %}
  50. <td><ul>{% for warning in status.warnings %}<li>{{ warning }}</li>{% endfor %}</ul></td>
  51. {% endif %}
  52. {% endif %}
  53. </tr>
  54. {% endfor %}
  55. </tbody>
  56. </table>
  57. </div>
  58. <script>
  59. $(document).ready( function () {
  60. // Datatable
  61. $('#results').DataTable();
  62. } );
  63. // Charts
  64. var labels = [];
  65. var values = [];
  66. {% for lbl, val in scan.labelledStats %}
  67. labels.push('{{ lbl }}');
  68. values.push({{ val }});
  69. {% endfor %}
  70. {% autoescape 'js' %}
  71. var ctx = document.getElementById('chart_stats').getContext('2d');
  72. var myChart = new Chart(ctx, {
  73. type: 'bar',
  74. data: {
  75. labels: labels,
  76. datasets: [{
  77. label: 'Stats',
  78. data: values,
  79. backgroundColor: [
  80. 'rgba(255, 99, 132, 0.2)',
  81. 'rgba(54, 162, 235, 0.2)',
  82. 'rgba(255, 206, 86, 0.2)',
  83. 'rgba(75, 192, 192, 0.2)',
  84. 'rgba(153, 102, 255, 0.2)',
  85. 'rgba(255, 159, 64, 0.2)'
  86. ],
  87. borderColor: [
  88. 'rgba(255, 99, 132, 1)',
  89. 'rgba(54, 162, 235, 1)',
  90. 'rgba(255, 206, 86, 1)',
  91. 'rgba(75, 192, 192, 1)',
  92. 'rgba(153, 102, 255, 1)',
  93. 'rgba(255, 159, 64, 1)'
  94. ],
  95. borderWidth: 1
  96. }]
  97. },
  98. options: {
  99. responsive: true,
  100. maintainAspectRatio: false
  101. }
  102. });
  103. {% endautoescape %}
  104. </script>
  105. </body>
  106. </html>