{% extends "layout.html" %}

{% block content %}
<ol class="breadcrumb">
  <li>{{ macros.make_link('playbook', 'Playbook', playbook=task.playbook.id) }}</li>
  <li>{{ macros.make_link('play', 'Play', play=task.play.id) }}</li>
  <li class="active"><strong>Task</strong>{% if task.name %}: "{{task.name}}"{% endif %}</li>
</ol>

<h2>Task information</h2>
<table class="summary table table-striped table-bordered table-hover table-condensed">
  <thead>
    <tr>
      <th>Start</th>
      <th>End</th>
      <th>Duration</th>
      <th>Action</th>
      <th>File</th>
      <th>Line</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>{{ task.time_start |datetime }}</td>
      <td>{{ task.time_end |datetime }}</td>
      <td>{{ task.duration }}</td>
      <td>{{ task.action }}</td>
      <td>{{ task.path }}</td>
      <td>{{ task.lineno }}</td>
    </tr>
  </tbody>
</table>

<h2>Results</h2>
<table class="results table table-striped table-bordered table-hover table-condensed">
  <thead>
    <tr>
      <th>Start</th>
      <th>End</th>
      <th>Duration</th>
      <th>Host</th>
      <th>Status</th>
      <th></th>
    </tr>
  </thead>

  <tbody>
    {% for result in task.task_results.order_by('time_start') %}
    <tr>
      <td>{{ result.time_start |datetime }}</td>
      <td>{{ result.time_end |datetime }}</td>
      <td>{{ result.duration }}</td>
      <td>{{ macros.make_link('host', result.host.name, host=result.host.name) }}</td>
      <td>{{ result|pick_status }}</td>
      <td>{{ macros.make_link('task_result', 'details', task_result=result.id) }}</td>
    </tr>
    {% endfor %}
  </tbody>
</table>
{% endblock %}
