<nav aria-label="breadcrumb">
  <ol class='breadcrumb'>
    <li class="breadcrumb-item"><a href='../'>Experiments</a></li>
    <li class="breadcrumb-item active">#<%= @experiment.id %> </li>
  </ol>
</nav>

<h1>Experiment #<%= @experiment.id %>: <%= @experiment.title %></h1>

 <details>
   <summary class='btn btn-info'><span class="fa fa-download"></span> Download all regression logs</summary>
   <code><pre>wget -qO - <%= base_url %>/experiments/<%= @experiment.id %>/regression-logs/ \
| xargs -n 2 wget --header='Accept: text/plain' -O</pre></code>
 </details>


<table class='table'>
  <tr>
    <th>Package</th>
    <th colspan='2'>Control</th>
    <th colspan='2'>Test</th>
    <th>Diagnostics</th>
  </tr>
  <tr>
    <th>
      -
    </th>
    <th colspan='2'>
      <ul>
      <% @experiment.control_parameters.each do |key, value| %>
        <li><strong><%= key %></strong>: <%= value %></li>
      <% end %>
      </ul>
    </th>
    <th colspan='2'>
      <ul>
      <% @experiment.test_parameters.each do |key, value| %>
        <li><strong><%= key %></strong>: <%= value %></li>
      <% end %>
      </ul>
    </th>
    <th>
      -
    </th>
  </tr>
  <% @tests.records.each do |test| %>
    <tr>
      <td><%= test.control_job.package.name %></td>
      <td>
        <%== icon(test.control_job.status) %>
        <%= test.control_job.status || 'pending' %>
      </td>
      <td>
        <%== log_links(test.control_job) %>
      </td>
      <td>
        <%== icon(test.test_job.status) %>
        <%= test.test_job.status || 'pending' %>
      </td>
      <td>
        <%== log_links(test.test_job) %>
      </td>
      <td>
        <% if test.regression? %>
          <span class="badge text-bg-danger">Regression</span>
        <% elsif test.improvement? %>
          <span class="badge text-bg-success">Improvement</span>
        <% end %>
      </td>
    </tr>
  <% end %>
</table>


<%== erb(:pagination, locals: { results: @tests }) %>
