report.html 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. {% extends '_base.html' %}
  2. {% load helpers %}
  3. {% block title %}{{ report.name }}{% endblock %}
  4. {% block content %}
  5. <div class="row noprint">
  6. <div class="col-md-12">
  7. <ol class="breadcrumb">
  8. <li><a href="{% url 'extras:report_list' %}">Reports</a></li>
  9. <li><a href="{% url 'extras:report_list' %}#module.{{ report.module }}">{{ report.module|bettertitle }}</a></li>
  10. <li>{{ report.name }}</li>
  11. </ol>
  12. </div>
  13. </div>
  14. {% if perms.extras.add_reportresult %}
  15. <div class="pull-right noprint">
  16. <form action="{% url 'extras:report_run' name=report.full_name %}" method="post">
  17. {% csrf_token %}
  18. {{ run_form }}
  19. <button type="submit" name="_run" class="btn btn-primary"><i class="fa fa-play"></i> Run Report</button>
  20. </form>
  21. </div>
  22. {% endif %}
  23. <h1>{{ report.name }}{% include 'extras/inc/report_label.html' with result=report.result %}</h1>
  24. <div class="row">
  25. <div class="col-md-12">
  26. {% if report.description %}
  27. <p class="lead">{{ report.description }}</p>
  28. {% endif %}
  29. {% if report.result %}
  30. <p>Last run: <strong>{{ report.result.created }}</strong></p>
  31. {% endif %}
  32. {% if report.result %}
  33. <div class="panel panel-default">
  34. <div class="panel-heading">
  35. <strong>Report Methods</strong>
  36. </div>
  37. <table class="table table-hover panel-body">
  38. {% for method, data in report.result.data.items %}
  39. <tr>
  40. <td><code><a href="#{{ method }}">{{ method }}</a></code></td>
  41. <td class="text-right report-stats">
  42. <label class="label label-success">{{ data.success }}</label>
  43. <label class="label label-info">{{ data.info }}</label>
  44. <label class="label label-warning">{{ data.warning }}</label>
  45. <label class="label label-danger">{{ data.failure }}</label>
  46. </td>
  47. </tr>
  48. {% endfor %}
  49. </table>
  50. </div>
  51. <div class="panel panel-default">
  52. <div class="panel-heading">
  53. <strong>Report Results</strong>
  54. </div>
  55. <table class="table table-hover panel-body report">
  56. <thead>
  57. <tr class="table-headings">
  58. <th>Time</th>
  59. <th>Level</th>
  60. <th>Object</th>
  61. <th>Message</th>
  62. </tr>
  63. </thead>
  64. <tbody>
  65. {% for method, data in report.result.data.items %}
  66. <tr>
  67. <th colspan="4" style="font-family: monospace">
  68. <a name="{{ method }}"></a>{{ method }}
  69. </th>
  70. </tr>
  71. {% for time, level, obj, url, message in data.log %}
  72. <tr class="{% if level == 'failure' %}danger{% elif level %}{{ level }}{% endif %}">
  73. <td>{{ time }}</td>
  74. <td>
  75. <label class="label label-{% if level == 'failure' %}danger{% else %}{{ level }}{% endif %}">{{ level|title }}</label>
  76. </td>
  77. <td>
  78. {% if obj and url %}
  79. <a href="{{ url }}">{{ obj }}</a>
  80. {% elif obj %}
  81. {{ obj }}
  82. {% endif %}
  83. </td>
  84. <td>{{ message }}</td>
  85. </tr>
  86. {% endfor %}
  87. {% endfor %}
  88. </tbody>
  89. </table>
  90. </div>
  91. {% else %}
  92. <div class="well">No results are available for this report. Please run the report first.</div>
  93. {% endif %}
  94. </div>
  95. <div class="col-md-3">
  96. {% if report.result %}
  97. {% endif %}
  98. </div>
  99. </div>
  100. {% endblock %}