{% extends "layout.html" %}

{% block content %}

<h1>
  Builder <a href="{{ builder_link }}">{{ b.getBuilder().getName() }}</a> 
  build <a href="{{ build_link }}">#{{ b.getNumber() }}</a> 
  step <a href="">{{ s.getName() }}</a> 
</h1>

<div class="column">

{% if s.isFinished() %}
  <h2>Finished</h2>
  <p class="{{ result_css }} result">  
    {%- set text = s.getText() -%}
    {%- if text is string %}{{ text|e }}
    {%- else %}{{ text|join(" ")|e }}{% endif -%}
  </p>  
{% else %}
  <h2>Not Finished</h2>
  <p>ETA {{ s.getETA()|e }} seconds</p>
{% endif %}

{% set exp = s.getExpectations() %}
{% if exp %}
  <h2>Expectations</h2>
  <ul>
  {% for e in exp %}
    <li>{{ e[0]|e }}: current={{ e[1] }}, target={{ e[2] }}</li>
  {% endfor %}
  </ul>
{% endif %}

<h2>Timing</h2>
{% if start %}
  <table class="info">
    <tr class="alt"><td class="left">Start</td><td>{{ start }}</td></tr>
    <tr><td class="left">End</td><td>{{ end or "Not finished" }}</td></tr>
    <tr class="alt"><td class="left">Elapsed</td><td>{{ elapsed }}</td></tr>
  </table>
{% else %}
  <b>Not started</b>
{% endif %}
  
<h2>Logs</h2>
<ul>
{% for l in logs %}
  <li class="{{ loop.cycle('alt', '') }}">
  {% if l.has_contents %}
    <a href="{{ l.link|e }}">{{ l.name|e }}</a>
  {% else %}
    {{ l.name|e }}
  {% endif %}
  </li>
{% else %}
  <li class="alt">- No logs -</li> 
{% endfor %}
</ul>

{% if statistics %}
<h2>Statistics</h2>
<table class="info">
  <tr><th>Name</th><th>Value</th></tr>
  {% for stat in statistics %}
    <tr class="{{ loop.cycle('alt', '') }}"><td>{{ stat.name|e }}</td><td>{{ stat.value|e }}</td></tr>
  {% endfor %}
</table>
{% endif %}

</div>

{% endblock %}
