{% extends "base.html" %}
{% load pygments_highlights %}
{% load datetime_formatting %}
{% load diff_result %}
{% load static_url %}
{% block body %}
  <div>
    {% include "partials/playbook_card.html" with playbook=result.playbook %}
  </div>
  <br/>
  <div>
    <div class="card">
      <div class="card-header">
        <h4>Task result details</h4>
      </div>
      <div class="card-body">
        <ul>
          <li><strong>Play</strong>: {{ result.play.name }}</li>
          <li><strong>Task</strong>: {{ result.task.name }}</li>
          <li><strong>Action</strong>: {{ result.task.action }}</li>
          {% url 'ui:file' result.task.file as file_url %}
          <li><strong>Path</strong>: <a href="{% static_url file_url %}#line-{{ result.task.lineno }}">{{ result.task.path }}:{{ result.task.lineno }}</a></li>
          {% url 'ui:host' result.host.id as host_url %}
          <li><strong>Host</strong>: <a href="{% static_url host_url %}">{{ result.host.name }}</a></li>
          <li><strong>Status</strong>: {{ result.status }}</li>
          <li><strong>Started</strong>: {{ result.started | format_date }}</li>
          <li><strong>Ended</strong>: {{ result.ended | format_date }}</li>
          <li><strong>Duration</strong>: {{ result.duration | format_duration }}</li>
        </ul>
        <div class="table-responsive">
          <table class="table table-sm table-hover" style="table-layout:fixed; max-width:100%;">
            <thead>
            <tr>
              <th style="width:20%;">Field</th>
              <th style="width:80%;">Value</th>
            </tr>
            </thead>
            <tbody>
            {% for field, value in result.content.items %}
              <tr>
                <td id="{{ field }}">
                  <a href="#{{ field }}">{{ field }}</a>
                </td>
                <td>
                  {% if field == "diff" %}
                    {{ value | diff_result | format_data | safe }}
                  {% elif field == "results" %}
                    {% include "partials/nested_results.html" with results=value %}
                  {% else %}
                    {{ value | format_data | safe }}
                  {% endif %}
                </td>
              </tr>
            {% endfor %}
            </tbody>
          </table>
        </div>
      </div>
    </div>
  </div>
  <br/>
{% endblock %}
