{% extends "layout.html" %}

{% block content %}
<ol class="breadcrumb">
  <li class="active"><strong>Playbook</strong>{% if playbook.path %}:
    "{{playbook.path}}"{% endif %}</li>
</ol>

<h2>Playbook {% if playbook.path %}"{{
  playbook.path|pathtruncate }}"
  {% else %}{{playbook.id}}{% endif %}</h2>
<table class="summary table table-striped table-bordered table-hover table-condensed">
  <thead>
    <tr>
      <th>Start</th>
      <th>End</th>
      <th>Duration</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>{{ playbook.time_start |datefmt }}</td>
      <td>{{ playbook.time_end |datefmt }}</td>
      <td>{{ playbook.duration |timefmt }}</td>
    </tr>
  </tbody>
</table>

<h2>Statistics</h2>
<table class="stats table table-striped table-bordered table-hover table-condensed">
  <thead>
    <tr>
      <th>Host</th>
      <th><span class="ok label status-label">OK</span></th>
      <th><span class="changed label status-label">CHANGED</span></th>
      <th><span class="failed label status-label">FAILED</span></th>
      <th><span class="skipped label status-label">SKIPPED</span></th>
      <th><span class="unreachable label status-label">UNREACHABLE</span></th>
    </tr>
  </thead>
  <tbody>
    {% for stat in playbook.stats %}
    <tr>
      <td>{{ macros.make_link('playbook.playbook_results', stat.host.name, playbook=playbook.id, host=stat.host.name) }}</td>
        {{ macros.statslink(stat, 'ok', playbook, stat.host) }}
        {{ macros.statslink(stat, 'changed', playbook, stat.host) }}
        {{ macros.statslink(stat, 'failed', playbook, stat.host) }}
        {{ macros.statslink(stat, 'skipped', playbook, stat.host) }}
        {{ macros.statslink(stat, 'unreachable', playbook, stat.host) }}
    </tr>
    {% endfor %}
  </tbody>
</table>

<h2>Plays</h2>
<table class="plays table table-striped table-bordered table-hover table-condensed">
  <thead>
    <tr>
      <th>Start</th>
      <th>End</th>
      <th>Duration</th>
      <th></th>
    </tr>
  </thead>

  <tbody>
    {% for play in plays %}
    <tr>
      <td>{{ playbook.time_start |datefmt }}</td>
      <td>{{ playbook.time_end |datefmt }}</td>
      <td>{{ playbook.duration |timefmt }}</td>
      <td>{{ macros.make_link('play.show_play', 'details', play=play.id) }}</td>
    </tr>
    {% endfor %}
  </tbody>
</table>

<h2>Tasks</h2>
<table class="tasks table table-striped table-bordered table-hover table-condensed">
  <thead>
    <tr>
      <th>Offset from Playbook</th>
      <th>Duration</th>
      <th>Action</th>
      <th>File</th>
      <th>Line</th>
      <th></th>
    </tr>
  </thead>

  <tbody>
    {% for task in tasks %}
    <tr>
      <td>{{ task.offset_from_playbook |timefmt }}</td>
      <td>{{ task.duration |timefmt }}</td>
      <td>{{ task.action }}</td>
      <td>{{ task.path|pathtruncate }}</td>
      <td>{{ task.lineno }}</td>
      <td>{{ macros.make_link('task.show_task', 'details', task=task.id) }}
      </td>
    </tr>
    {% endfor %}
  </tbody>
</table>
{% endblock %}
