{% extends "dashboard_app/_content_with_sidebar.html" %}
{% load i18n %}
{% load humanize %}


{% block content %}
<script type="text/javascript" charset="utf-8"> 
  $(document).ready(function() {
    oTable = $('#test_results').dataTable({
      "bJQueryUI": true,
      "sPaginationType": "full_numbers",
      "aaSorting": [[0, "asc"]],
    });
  });
</script> 
<table class="demo_jui display" id="test_results">
  <thead>
    <tr>
      <th>#</th>
      <th>{% trans "Test case" %}</th>
      <th>{% trans "Result" %}</th>
      <th>{% trans "Measurement" %}</th>
    </tr>
    <tbody>
      {% for test_result in test_run.test_results.select_related.all %}
      <tr>
        <td width="1%">{{ test_result.relative_index }}</td>
        <td>{{ test_result.test_case|default_if_none:"<em>Not specified</em>" }}</td>
        <td>
          <a href ="{{test_result.get_absolute_url}}">
            <img src="{{ STATIC_URL }}dashboard_app/images/icon-{{ test_result.result_code }}.png"
            alt="{{ test_result.get_result_display }}" width="16" height="16" border="0"/></a>
          <a href ="{{test_result.get_absolute_url}}">{{ test_result.get_result_display }}</a>
        </td>
        <td>{{ test_result.measurement|default_if_none:"Not specified" }} {{ test_result.units }}</td>
      </tr>
      {% endfor %}
    </tbody>
  </table>
  {% endblock %}


{% block sidebar %}
<dl>
  <dt>{% trans "Test Run UUID" %}</dt>
  <dd>{{ test_run.analyzer_assigned_uuid }} <a href="{% url dashboard_app.views.redirect_to_test_run test_run.analyzer_assigned_uuid %}">{% trans "permalink" %}</a></dd>
  <dt>{% trans "Test Name" %}</dt>
  <dd><a href="{{ test_run.test.get_absolute_url }}">{{ test_run.test }}</a></dd>
  <dt>{% trans "OS Distribution" %}</dt>
  <dd>{{ test_run.sw_image_desc|default:"<i>Unspecified</i>" }}</dd>
  <dt>{% trans "Bundle SHA1" %}</dt>
  <dd><a href="{{ test_run.bundle.get_absolute_url }}">{{ test_run.bundle.content_sha1 }}</a></dd>
  <dt>{% trans "Time check performed" %}</dt>
  <dd>{{ test_run.time_check_performed|yesno }}</dd>
  <dt>{% trans "Log analyzed on:" %}</dt>
  <dd>
  {{ test_run.analyzer_assigned_date|naturalday }}
  {{ test_run.analyzer_assigned_date|time }}
  </dd>
  <dt>{% trans "Data uploaded on:" %}</dt>
  <dd>
  {{ test_run.import_assigned_date|naturalday }}
  {{ test_run.import_assigned_date|time }}
  </dd>
  <dt>{% trans "Other information:" %}</dt>
  <dd><a 
    href="{% url dashboard_app.views.test_run_hardware_context test_run.bundle.bundle_stream.pathname test_run.bundle.content_sha1 test_run.analyzer_assigned_uuid %}"
    >{% trans "Hardware context" %} ({{ test_run.devices.all.count }} devices)</a></dd>
  <dd><a 
    href="{% url dashboard_app.views.test_run_software_context test_run.bundle.bundle_stream.pathname test_run.bundle.content_sha1 test_run.analyzer_assigned_uuid %}"
    >{% trans "Software context" %} ({{ test_run.packages.all.count }} packages, {{ test_run.sources.all.count }} sources)</a></dd>
  <dd><a 
    href="{% url dashboard_app.views.attachment_list test_run.bundle.bundle_stream.pathname test_run.bundle.content_sha1 test_run.analyzer_assigned_uuid %}"
    >{% trans "Attachments" %} ({{ test_run.attachments.count }})</a></dd>
  </dd>
</dl>
{% endblock %}
