{% extends "layouts/content.html" %}

{% load django_tables2 %}

{% block content %}
<h2>Device status transition</h2>

<div class="row">
  <div class="col-md-6">
    <dl class="dl-horizontal">
      <dt>When</dt>
      <dd>{{ transition.created_on }}</dd>
      <dt>Device name</dt>
      <dd><a href="{{ transition.device.get_absolute_url }}">{{ transition.device.hostname }}</a></dd>
      <dt>Type</dt>
      <dd><a href="{{ transition.device.device_type.get_absolute_url }}">{{ transition.device.device_type }}</a></dd>
      <dt>Job</dt>
    {% if transition.job %}
      <dd><a href="{{ transition.job.get_absolute_url }}">{{ transition.job }}</a></dd>
    {% else %}
      <dd><i>None</i></dd>
    {% endif %}
    </dl>
  </div>
  <div class="col-md-6">
    <dl class="dl-horizontal">
      <dt>Created by:</dt>
      <dd>{{ transition.created_by|default:"<i>None</i>" }}</dd>
      <dt>Transitioned from:</dt>
      <dd>{{ old_state }}</dd>
      <dt>to:</dt>
      <dd>{{ new_state }}</dd>
      <dt>Message:</dt>
    {% if transition.message %}
      <dd>{{ transition.message }}</dd>
    {% else %}
      <dd>None</dd>
    {% endif %}
    </dl>
  </div>
</div>

<h2>Status transitions for {{ device.hostname }}</h2>

{% render_table transition_table %}

{% endblock %}

{% block scripts %}
<script type="text/javascript" src="{{ STATIC_URL }}lava_scheduler_app/js/tables.min.js"></script>
{% endblock %}
