{% extends "_base.html" %}
{% block title %}{{ super() }} {% trans %}Job status{% endtrans %} {% endblock %}
{% block crumbs %}{{ super() }}
/ <a href="../jobs">{% trans %}Jobs{% endtrans %}</a>
/ <a href="./{{ data['jobs']['jobID'] }}">{{ data['jobs']['jobID'] }}</a>
{% endblock %}
{% block body %}
    <section id="job">
      <div class="row">
        <h1>{% trans %}Job status{% endtrans %}</h1>
      </div>
      <div class="row">
        <div class="col-md-12">
          <div id="job-status" class="{{ data['jobs']['status'] }}">
            <div id="job-status-header" class="{{ data['jobs']['status'] }}">
              <p>{% trans %}Status{% endtrans %}: {{ data['jobs']['status'] }}</p>
              <p class="progress">{% trans %}Progress{% endtrans %}: {{ data['jobs']['progress'] }}%</p>
            </div>
            <div id="job-status-body">
              <div class="message">
                <h3>{% trans %}Message{% endtrans %}</h3>
                <p>{{ data['jobs']['message'] }}</p>
              </div>
              {% if data['jobs']['parameters'] %}
              <div class="message">
                <h3>{% trans %}Parameters{% endtrans %}</h3>
                <pre id="job-parameters"></pre>
              </div>
              <script>
                var parameters = {{ data['jobs']['parameters'] | to_json | safe }};
                document.getElementById('job-parameters').innerHTML = JSON.stringify(JSON.parse(parameters), undefined, 2);
              </script>
              {% endif %}
              <div class="duration">
                <h4><label for="progress">{% trans %}Progress{% endtrans %}</label></h4>
                <progress id="progress" class="inline" value="{{ data['jobs']['progress']|int*10 }}" max="1000"></progress>
                <h4><label for="runtime">{% trans %}Duration{% endtrans %}</label></h4>
                <p><span id="runtime">
                  {% if data['jobs']['status'] == 'running' %}
                    {{ data['jobs']['started']|format_duration(data.now) }}
                  {% else %}
                    {{ data['jobs']['started']|format_duration(data['jobs']['finished']) }}
                  {% endif %}
                </span></p>
                <h4><label for="starttime">{% trans %}Started processing{% endtrans %}</label></h4>
                <p><span id="starttime">{{ data['jobs']['started']|format_datetime }}</span></p>
                <h4><label for="endtime">{% trans %}Finished processing{% endtrans %}</label></h4>
                <p><span id="endtime">{{ data['jobs']['finished']|format_datetime }}</span></p>

                <h3>{% trans %}Links{% endtrans %}</h3>
                <ul>
                  {% for link in data['jobs']['links'] %}
                  <li><a title="{{ link['rel'] }}" href="{{ link['href'] }}"><span>{{ link['title'] }}</span> (<span>{{ link['type'] }}</span>)</a></li>
                  {% endfor %}
                </ul>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>
{% endblock %}
