{% extends "layouts/content.html" %}

{% block extrahead %}
{{ block.super }}
<script type="text/javascript" src="{{ STATIC_URL }}lava_kernel_ci_views_app/js/nested-render.js"></script>
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}lava_kernel_ci_views_app/css/nested-render.css"></style>
{% endblock %}

{% block breadcrumbs %}
{{ block.super }}
<li><a href="{% url lava_kernel_ci_views_app.views.index %}">Kernel CI Views</a></li>
{% endblock %}

{% block content %}
  <body>
    <p>
      <b>Show tests run on:</b>
      {% for board_class in board_classes %}
      <input class="showhide test" type="checkbox" value=".test-{{ board_class }}" checked="true"/>{{ board_class }}
      {% endfor %}
    </p>
    <p>
      <b>Show builds of configs:</b>
      {% for config in configs %}
      <input class="showhide config" type="checkbox" value=".build-{{ config }}" checked="true"/>{{ config }}
      {% endfor %}
    </p>
    <p>
      <b>Show trees:</b>
      {% for tree in trees %}
      <input class="showhide tree" type="checkbox" value=".tree-{{ tree.1 }}" checked="true"/>{{ tree.0 }}
      {% endfor %}
    </p>
    <ul class="container days">
      <ul class="container trees">
        {% for tree in data.trees %}
        <li class="cell tree tree-{{ tree.index }}" style="width: {{ tree.width }}%">
          <div class="item tree">
            {{ tree.url }}
          </div>
        </li>
        {% endfor %}
      </ul>
      {% for day in data.days %}
      <li class="day">
        <div class="item day">
          <div class="item-inner day">
            {{ day.date }} &ndash; {{ day.test_count }} tests of
            {{ day.build_count }} builds on {{ day.tree_count }} trees
          </div>
        </div>
        <ul class="container trees">
          {% for tree in day.trees %}
          <li class="tree tree-{{ tree.index }} cell" style="width: {{ tree.width }}%">
            <ul class="container commits">
              {% for commit in tree.commits %}
              <li class="commit">
              <li class="dummy build cell build-dummy">
                <ul class="container tests">
                  <li class="cell test dummy">
                    <div class="item test test-dummy result result-dummy">
                      <div class="item-inner test test-dummy result result-dummy">
                        &nbsp;<br/>&nbsp;
                      </div>
                    </div>
                  </li>
                </ul>
                <div class="item build build-dummy result result-dummy">
                  <div class="item-inner build build-dummy result result-dummy">
                    &nbsp;<br/>&nbsp;
                  </div>
                </div>
              </li>
                <ul class="container builds">
                  {% for build in commit.builds %}
                  <li class="build cell build-{{ build.config }}" style="width: {{ build.width }}%">
                    <ul class="container tests">
                      <li class="cell test dummy">
                        <div class="item test test-dummy result result-dummy">
                          <div class="item-inner test test-dummy result result-dummy">
                            &nbsp;<br/>&nbsp;<br/>&nbsp;<br/>&nbsp;
                          </div>
                        </div>
                      </li>
                      {% for test in build.tests %}
                      <li class="cell test" style="width: 100%">
                        <div class="item test test-{{ test.board_class }} result result-{{ test.result }}">
                          <div class="item-inner test test-{{ test.board_class }} result result-{{ test.result }}">
                            <a href="{{ link_prefix }}{{ test.sha1 }}">{{ test.board_class }}</a>&nbsp;test:<br />
                            {{ test.test_count }}&nbsp;total<br />
                            {{ test.passes }}&nbsp;passed{% if test.fail_to_pass %}&nbsp;({{test.fail_to_pass}}&nbsp;fixed){% endif %}<br />
                            {{ test.fails }}&nbsp;failed{% if test.pass_to_fail %}&nbsp;({{test.pass_to_fail}}&nbsp;regressed){% endif %}
                          </div>
                        </div>
                      </li>
                      {% endfor %}
                    </ul>
                    <div class="item build build-{{ build.config }} result result-{{ build.result }}">
                      <div class="item-inner build build-{{ build.config }} result result-{{ build.result }}">
                        Build&nbsp;of<br /><a href="{{ link_prefix }}{{ build.sha1 }}">{{ build.config }}</a>
                      </div>
                    </div>
                  </li>
                  {% endfor %}
                </ul>
                <div class="item commit">
                  <div class="item-inner commit"
                       title="{{ commit.log_info }}">
                    {% if commit.commit_url %}
                    <a href="{{ commit.commit_url }}">{{ commit.describe }}</a>
                    {% else %}
                    {{ commit.describe }}
                    {% endif %}
                    {% if commit.shortlog_url %}
                    &nbsp<a href="{{ commit.shortlog_url }}">shortlog</a>
                    {% endif %}
                  </div>
                </div>
              </li>
              {% endfor %}
            </ul>
          </li>
          {% endfor %}
        </ul>
      </li>
      {% endfor %}
    </ul>
    <p style="clear:both">
      {% if newer_results_link %}
      <a                     href="{{ newer_results_link }}">&lsaquo;&lsaquo; Newer results</a>
      {% endif %}
      &nbsp;
      {% if older_results_link %}
      <a style="float:right" href="{{ older_results_link }}">Older results  &rsaquo;&rsaquo;</a>
      {% endif %}
    </p>
    <script>
      $('input.showhide.config').click(function () { hideCells(this, '.builds.container'); });
      $('input.showhide.test').click(function () { hideCells(this, '.tests.container'); });
      $('input.showhide.tree').click(function () { hideCells(this, '.trees.container'); });
    </script>

{% endblock %}
