| 1 | {% extends 'base.html' %} |
| 2 | {% comment %} |
| 3 | # SPDX-License-Identifier: AGPL-3.0-or-later |
| 4 | {% endcomment %} |
| 5 | |
| 6 | {% load i18n %} |
| 7 | {% load extras %} |
| 8 | |
| 9 | {% block content %} |
| 10 | |
| 11 | {% if not is_task_running %} |
| 12 | <div class="btn-toolbar"> |
| 13 | <form class="form form-diagnostics-full" method="post" |
| 14 | action="{% url 'diagnostics:full' %}"> |
| 15 | {% csrf_token %} |
| 16 | |
| 17 | <input type="submit" class="btn btn-primary" |
| 18 | value="{% trans "Re-run Diagnostics" %}"/> |
| 19 | </form> |
| 20 | </div> |
| 21 | {% else %} |
| 22 | <p>{% trans "Diagnostics test is currently running" %}</p> |
| 23 | <div class="progress"> |
| 24 | <div class="progress-bar progress-bar-striped active |
| 25 | w-{{ results.progress_percentage }}" |
| 26 | role="progressbar" aria-valuemin="0" aria-valuemax="100" |
| 27 | aria-valuenow="{{ results.progress_percentage }}"> |
| 28 | {{ results.progress_percentage }}% |
| 29 | </div> |
| 30 | </div> |
| 31 | |
| 32 | {% endif %} |
| 33 | |
| 34 | {% if results %} |
| 35 | <h3>{% trans "Results" %}</h3> |
| 36 | <div class="accordion" id="diagnostics-results"> |
| 37 | {% for app_id, app_data in results.results.items %} |
| 38 | <div class="accordion-item"> |
| 39 | <h4 class="accordion-header" id="#heading-{{ app_id }}"> |
| 40 | <button class="accordion-button collapsed" type="button" |
| 41 | data-bs-toggle="collapse" |
| 42 | data-bs-target="#collapse-{{ app_id }}" |
| 43 | aria-expanded="false" |
| 44 | aria-controls="collapse-{{ app_id }}"> |
| 45 | <div class="d-flex align-items-center flex-wrap w-100"> |
| 46 | <div class="flex-grow-1 me-1">{{ app_data.name }}</div> |
| 47 | |
| 48 | {% if app_data.diagnosis %} |
| 49 | {% regroup app_data.diagnosis|dictsort:"result" by result as result_groups %} |
| 50 | {% for group in result_groups %} |
| 51 | {% with group.list|length as number %} |
| 52 | {% if group.grouper == 'passed' %} |
| 53 | <span class="badge text-bg-success mx-1"> |
| 54 | {% blocktrans %}{{ number }} passed{% endblocktrans %} |
| 55 | </span> |
| 56 | {% elif group.grouper == 'failed' %} |
| 57 | <span class="badge text-bg-danger mx-1"> |
| 58 | {% blocktrans %}{{ number }} failed{% endblocktrans %} |
| 59 | </span> |
| 60 | {% elif group.grouper == 'warning' %} |
| 61 | <span class="badge text-bg-warning mx-1"> |
| 62 | {% blocktrans %}{{ number }} warnings{% endblocktrans %} |
| 63 | </span> |
| 64 | {% elif group.grouper == 'error' %} |
| 65 | <span class="badge text-bg-warning mx-1"> |
| 66 | {% blocktrans %}{{ number }} errors{% endblocktrans %} |
| 67 | </span> |
| 68 | {% elif group.grouper == 'skipped' %} |
| 69 | <span class="badge text-bg-secondary mx-1"> |
| 70 | {% blocktrans %}{{ number }} skipped{% endblocktrans %} |
| 71 | </span> |
| 72 | {% endif %} |
| 73 | {% endwith %} |
| 74 | {% endfor %} |
| 75 | {% elif app_data.exception %} |
| 76 | {% icon 'exclamation-triangle' %} |
| 77 | {% else %} |
| 78 | {% icon 'hourglass-o' %} |
| 79 | {% endif %} |
| 80 | |
| 81 | {% if app_data.show_repair %} |
| 82 | <form class="form form-diagnostics-repair-button mx-1" method="post" |
| 83 | action="{% url 'diagnostics:repair' app_id=app_id %}"> |
| 84 | {% csrf_token %} |
| 85 | <input type="submit" class="btn btn-default" |
| 86 | name="repair" value="{% trans "Try to repair" %}"/> |
| 87 | </form> |
| 88 | {% endif %} |
| 89 | </div> |
| 90 | </button> |
| 91 | </h4> |
| 92 | |
| 93 | <div class="accordion-collapse collapse" id="collapse-{{ app_id }}" |
| 94 | aria-labelledby="heading-{{ app_id }}" |
| 95 | data-bs-parent="#diagnostics-results"> |
| 96 | <div class="accordion-body"> |
| 97 | {% if app_data.diagnosis %} |
| 98 | {% include "diagnostics_results.html" with results=app_data.diagnosis %} |
| 99 | {% elif app_data.exception %} |
| 100 | <div class="alert alert-danger d-flex align-items-center" role="alert"> |
| 101 | <div class="me-2"> |
| 102 | {% icon 'exclamation-triangle' %} |
| 103 | <span class="visually-hidden">{% trans "Caution:" %}</span> |
| 104 | </div> |
| 105 | <div> |
| 106 | {{ app_data.exception }} |
| 107 | </div> |
| 108 | </div> |
| 109 | {% else %} |
| 110 | <p class="text-center"> |
| 111 | {% icon 'hourglass-o' %} |
| 112 | {% trans "Running..." %} |
| 113 | </p> |
| 114 | {% endif %} |
| 115 | </div> |
| 116 | </div> |
| 117 | </div> |
| 118 | {% endfor %} |
| 119 | </div> |
| 120 | {% endif %} |
| 121 | {% endblock %} |