script_result.html 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. {% load helpers %}
  2. {% load log_levels %}
  3. {% load i18n %}
  4. <div class="htmx-container">
  5. <p>
  6. {% if job.started %}
  7. {% trans "Started" %}: <strong>{{ job.started|isodatetime }}</strong>
  8. {% elif job.scheduled %}
  9. {% trans "Scheduled for" %}: <strong>{{ job.scheduled|isodatetime }}</strong>
  10. {% else %}
  11. {% trans "Created" %}: <strong>{{ job.created|isodatetime }}</strong>
  12. {% endif %}
  13. {% if job.completed %}
  14. {% trans "Duration" %}: <strong>{{ job.duration }}</strong>
  15. {% endif %}
  16. <span id="pending-result-label">{% badge job.get_status_display job.get_status_color %}</span>
  17. </p>
  18. {% if job.completed %}
  19. {% if tests %}
  20. {# Summary of test methods #}
  21. <div class="card">
  22. <h2 class="card-header">{% trans "Test Summary" %}</h2>
  23. <table class="table table-hover">
  24. {% for test, data in tests.items %}
  25. <tr>
  26. <td class="font-monospace">{{ test }}</td>
  27. <td class="text-end report-stats">
  28. <span class="badge text-bg-success">{{ data.success }}</span>
  29. <span class="badge text-bg-info">{{ data.info }}</span>
  30. <span class="badge text-bg-warning">{{ data.warning }}</span>
  31. <span class="badge text-bg-danger">{{ data.failure }}</span>
  32. </td>
  33. </tr>
  34. {% endfor %}
  35. </table>
  36. </div>
  37. {% endif %}
  38. {% if table %}
  39. <div class="card">
  40. <div class="table-responsive" id="object_list">
  41. <h2 class="card-header">{% trans "Log" %}</h2>
  42. <div class="htmx-container table-responsive"
  43. hx-get="{% url 'extras:script_result' job_pk=job.pk %}?embedded=True&log=True&log_threshold={{log_threshold}}"
  44. hx-target="this"
  45. hx-trigger="load" hx-select=".htmx-container" hx-swap="outerHTML">
  46. </div>
  47. </div>
  48. </div>
  49. {% endif %}
  50. {# Script output. Legacy reports will not have this. #}
  51. {% if 'output' in job.data %}
  52. <div class="card mb-3">
  53. <h2 class="card-header d-flex justify-content-between">
  54. {% trans "Output" %}
  55. {% if job.completed %}
  56. <div>
  57. <a href="?export=output" class="btn btn-sm btn-primary" role="button">
  58. <i class="mdi mdi-download" aria-hidden="true"></i> {% trans "Download" %}
  59. </a>
  60. {% copy_content "job_data_output" %}
  61. </div>
  62. {% endif %}
  63. </h2>
  64. {% if job.data.output %}
  65. <pre class="card-body font-monospace" id="job_data_output">{{ job.data.output }}</pre>
  66. {% else %}
  67. <div class="card-body text-muted">{% trans "None" %}</div>
  68. {% endif %}
  69. </div>
  70. {% endif %}
  71. {% elif job.started %}
  72. {% include 'extras/inc/result_pending.html' %}
  73. {% endif %}
  74. </div>