{% extends "pyfarm/user_interface/layout.html" %}
{% block title %}Logs in Task {{ task.id }} {% endblock %}
{% block jobs_nb_class %}active{% endblock %}
{% block additional_styles %}
{% endblock %}
{% block content %}
<h1>Logs in Task {{ task.id }} </h1>
<h2>(Frame {{ task.frame }} from job <a href="{{ url_for('single_job_ui', job_id=task.job.id) }}">{{ task.job.title }}</a>)</h2>

{% for attempt, logs in attempts.items() %}
<div class="panel panel-default">
  <div class="panel-heading">Attempt {{ attempt }} </div>
  <table class="table">
    <tr>
      <th>Created On</th>
      <th>On Agent</th>
      <th>Logfile</th>
      <th>Tasks (Queued / Running / Failed / Done)</th>
    </tr>
    {% for log in logs %}
    <tr>
      <td class="timestamp">{{ log.log.created_on.isoformat() }}</td>
      <td>
        {% if log.log.agent %}
        <a href="{{ url_for('single_agent_ui', agent_id=log.log.agent.id) }}">{{ log.log.agent.hostname }}</a>
        {% endif %}
      </td>
      <td>
        <a href="/api/v1/jobs/{{ task.job.id }}/tasks/{{ task.id }}/attempts/{{ attempt }}/logs/{{ log.log.identifier }}/logfile">{{ log.log.identifier }}</a>
      </td>
      <td>
        {{ log.log.num_queued_tasks() }} /
        {{ log.log.num_running_tasks() }} /
        {{ log.log.num_failed_tasks() }} /
        {{ log.log.num_done_tasks() }}
      </td>
    </tr>
    {% endfor %}
  </table>
</div>
{%endfor%}

{% endblock %}
