<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Avocado Job Report</title>

    <style>
    {% include "bootstrap.min.css" %}
    </style>

    <style>
    {% include "datatables.css" %}
    </style>

    <style>
    {% include "style.css" %}
    </style>
  </head>

  <body>
    <div class="container">
      <div class="page-header">
        <h3>Avocado Job Report</h3>
      </div>

      <div class="panel-group" role="tablist">
        <div class="panel panel-default">
          <div class="panel-heading">
            <h4 class="panel-title">Summary</h4>
          </div>
          <table class="table table-bordered">
            <tr>
              <td>ID</td>
              <td><samp>{{ data.result.job_unique_id }}</samp></td>
            </tr>
            <tr>
              <td>Host</td>
              <td><samp>{{ data.hostname }}</samp></td>
            </tr>
            <tr>
              <td>Results Dir</td>
              <td><a href="{{ data.results_dir() }}"><samp>{{ data.results_dir_basename() }}</samp></a></td>
            </tr>
            <tr>
              <td>Cumulative test time</td>
              <td>{{ '%.2f'|format(data.result.tests_total_time) }} s</td>
            </tr>
            <tr>
              <td>Stats</td>
              <td>From {{ data.result.tests_total }} tests executed,
                {{ data.result.passed }} passed and
                {{ data.result.warned }} warned - success rate of
                {{ '%.2f'|format(data.result.rate) }}% (excluding SKIP and CANCEL)</td>
            </tr>
          </table>
        </div>
      </div>

      <table id="results" class="table table-striped table-bordered">
        <thead>
          <tr>
            <th>
              <span>Start Time</span>
              <div class="resizer"></div>
            </th>
            <th>
              <span>UID</span>
              <div class="resizer"></div>
            </th>
            <th>
              <span>Test Name</span>
              <div class="resizer"></div>
            </th>
            <th>
              <span>Variant</span>
              <div class="resizer"></div>
            </th>
            <th>
              <span>Status</span>
              <div class="resizer"></div>
            </th>
            <th>
              <span>Time (sec)</span>
              <div class="resizer"></div>
            </th>
            <th>
              <span>Info</span>
              <div class="resizer"></div>
            </th>
            <th>
              <span>Debug</span>
              <div class="resizer"></div>
            </th>
          </tr>
        </thead>
        <tbody>
        {% for test in data.tests %}
        <tr class="{{ data.row_class }}">
          <td data-toggle="popover" data-container="body" data-trigger="hover" data-content="{{ test.time_start }}"><div>{{ test.time_start }}</div></td>
          <td data-toggle="popover" data-container="body" data-trigger="hover" data-content="{{ test.uid }}"><div>{{ test.uid }}</div></td>
          <td data-toggle="popover" data-container="body" data-trigger="hover" data-content="{{ test.name }} | {{ test.params }}">
            <div>
              <a href="{{ test.logdir }}">{{ test.name }}</a>
            </div>
          </td>
          <td><div>{{ test.variant }}</div></td>
          <td><div>{{ test.status }}</div></td>
          <td><div>{{ test.time }}</div></td>
          <td data-toggle="popover"
              data-container="body"
              data-trigger="hover"
              data-placement="top"
              data-content="{{ test.fail_reason }}">
            <div>
              {{ test.fail_reason }}
            </div>
          </td>
          <td>
            <div>
              <a href="{{ test.logfile }}">
                <span class="icon icon-logs" title="Debug log"></span>
              </a>
            </div>
            <div data-toggle="popover" data-container="body" data-trigger="hover" data-placement="left" title="Whiteboard" data-content="{{test.whiteboard}}">
              <span class="icon icon-whiteboard"></span>
            </div>
          </td>
        </tr>
        {% endfor %}
        </tbody>
      </table>

      <div class="panel panel-default">
        <div class="panel-heading">
          <h3 class="panel-title">Sysinfo</h3>
        </div>
        <div class="panel-body">
          <div class="panel-group" id="accordionPre" role="tablist" aria-multiselectable="true">
            <div class="panel panel-default">
              <div class="panel-heading" role="tab" id="headingPre">
                <h4 class="panel-title">
                  <a data-toggle="collapse" data-parent="#accordionPre" href="#collapsePre" aria-expanded="false" aria-controls="collapsePre">Pre-Tests</a>
                </h4>
              </div>
              <div id="collapsePre" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingPre">
                <div class="panel-body">
                  <div class="panel-group" id="accordionPre2" role="tablist" aria-multiselectable="true">
                    {% for sysinfo in data.sysinfo_pre %}
                    <div class="panel panel-default">
                      <div class="panel-heading" role="tab" id="{{ sysinfo.element_id }}">
                        <h4 class="panel-title">
                          <a data-toggle="collapse" data-parent="#accordionPre2" href="#{{ sysinfo.collapse_id }}" aria-expanded="false" aria-controls="{{ sysinfo.collapse_id }}"><tt>{{ sysinfo.file }}</tt></a>
                        </h4>
                      </div>
                      <div id="{{ sysinfo.collapse_id }}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="{{ sysinfo.element_id }}">
                        <div class="panel-body">
                          <pre>{{ sysinfo.contents }}</pre>
                          {% if 'err' in sysinfo %}
                            <span>{{ sysinfo['err'] }}</span>
                            <a href="{{ sysinfo['err_file'] }}">{{ sysinfo['err_file'] }}</a>
                            <br />
                            <span>{{ sysinfo['err_details'] }}</span>
                          {% endif %}
                        </div>
                      </div>
                    </div>
                    {% endfor %}
                  </div>
                </div>
              </div>
            </div>
          </div>

          <div class="panel-group" id="accordionPost" role="tablist" aria-multiselectable="true">
            <div class="panel panel-default">
              <div class="panel-heading" role="tab" id="headingPost">
                <h4 class="panel-title">
                  <a data-toggle="collapse" data-parent="#accordionPost" href="#collapsePost" aria-expanded="false" aria-controls="collapsePost">Post-Tests</a>
                </h4>
              </div>
              <div id="collapsePost" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingPost">
                <div class="panel-body">
                  <div class="panel-group" id="accordionPost2" role="tablist" aria-multiselectable="true">
                    {% for sysinfo in data.sysinfo_post %}
                    <div class="panel panel-default">
                      <div class="panel-heading" role="tab" id="{{ sysinfo.element_id }}">
                        <h4 class="panel-title">
                          <a data-toggle="collapse" data-parent="#accordionPost2" href="#{{ sysinfo.collapse_id }}" aria-expanded="false" aria-controls="{{ sysinfo.collapse_id }}"><tt>{{ sysinfo.file }}</tt></a>
                        </h4>
                      </div>
                      <div id="{{ sysinfo.collapse_id }}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="{{ sysinfo.element_id }}">
                        <div class="panel-body">
                          <pre>{{ sysinfo.contents }}</pre>
                          {% if 'err' in sysinfo %}
                            <span>{{ sysinfo['err'] }}</span>
                            <a href="{{ sysinfo['err_file'] }}">{{ sysinfo['err_file'] }}</a>
                            <br />
                            <span>{{ sysinfo['err_details'] }}</span>
                          {% endif %}
                        </div>
                      </div>
                    </div>
                    {% endfor %}
                  </div>
                </div>
              </div>
            </div>
          </div>

          <div class="panel-group" id="accordionProfile" role="tablist" aria-multiselectable="true">
            <div class="panel panel-default">
              <div class="panel-heading" role="tab" id="headingProfile">
                <h4 class="panel-title">
                  <a data-toggle="collapse" data-parent="#accordionProfile" href="#collapseProfile" aria-expanded="false" aria-controls="collapseProfile">Profilers</a>
                </h4>
              </div>
              <div id="collapseProfile" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingProfile">
                <div class="panel-body">
                  <div class="panel-group" id="accordionProfile2" role="tablist" aria-multiselectable="true">
                    {% for sysinfo in data.sysinfo_profile %}
                    <div class="panel panel-default">
                      <div class="panel-heading" role="tab" id="{{ sysinfo.element_id }}">
                        <h4 class="panel-title">
                          <a data-toggle="collapse" data-parent="#accordionProfile2" href="#{{ sysinfo.collapse_id }}" aria-expanded="false" aria-controls="{{ sysinfo.collapse_id }}"><tt>{{ sysinfo.file }}</tt></a>
                        </h4>
                      </div>
                      <div id="{{ sysinfo.collapse_id }}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="{{ sysinfo.element_id }}">
                        <div class="panel-body">
                          <pre>{{ sysinfo.contents }}</pre>
                          {% if 'err' in sysinfo %}
                            <span>{{ sysinfo['err'] }}</span>
                            <a href="{{ sysinfo['err_file'] }}">{{ sysinfo['err_file'] }}</a>
                            <br />
                            <span>{{ sysinfo['err_details'] }}</span>
                          {% endif %}
                        </div>
                      </div>
                    </div>
                    {% endfor %}
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <script>
      {% include "jquery.min.js" %}
    </script>

    <script>
      {% include "bootstrap.min.js" %}
    </script>

    <script>
      {% include "datatables.min.js" %}
      {% include "datatables.bootstrap.js" %}
    </script>

    <script>
      {% include "avocado_html.js" %}
    </script>
  </body>
</html>
