{% extends "base.html" %}
{% load i18n %}

{% block page_title %}
Pinball - Workflow Instances
{% endblock %}

{% block javascript %}
<script src="{{ STATIC_URL }}js/executions.js"></script>
<script type="text/javascript" charset="utf-8">
  statusData = {
    "workflow" : "{{ request.GET.workflow }}",
    "instance" : "{{ request.GET.instance }}"
  };

  init = function() {
    baseInit();
    oTable = $('#executions').dataTable({
      // "sDom": "r<'row'<'span6'l><'span6'>f>t<'row'<'span6'i><'span6'>p>",
      "sPaginationType" : "bootstrap",
      "oLanguage" : {
        "sLengthMenu" : "_MENU_ records per page"
      },
      "bProcessing" : true,
      "sAjaxSource" : "/ajax/executions/?" + "workflow={{ request.GET.workflow }}&" + "instance={{ request.GET.instance }}&" + "job={{ request.GET.job }}",
      "fnCreatedRow" : addLogsLinks(false), // do not show instance
      "aoColumns" : [{
        "mData" : "execution"
      }, {
        "mData" : "info"
      }, {
        "mData" : "properties"
      }, {
        "mData" : "exit_code"
      }, {
        "mData" : "start_time"
      }, {
        "mData" : "end_time"
      }, {
        "mData" : "run_time"
      }, {
        "mData" : "logs"
      }],
      "fnServerData" : getTableData,
      "aLengthMenu" : [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
    });
  };
</script>
{% endblock %}

{% block workflows_active %}
class="active"
{% endblock %}

{% block breadcrumb %}
<ol class="breadcrumb">
  <li></li>
  <li>
    <a href="/instances/?workflow={{ request.GET.workflow }}"> {{ request.GET.workflow }} </a>
  </li>
  <li>
    <a href="/jobs/?workflow={{ request.GET.workflow }}&instance={{ request.GET.instance }}"> {{ request.GET.instance }} </a>
  </li>
  <li class="active">
    {{ request.GET.job }}
  </li>
</ol>
{% endblock breadcrumb %}

{% block content %}
<div class="row">
  <td align="left"><a href="/job_executions/?workflow={{ request.GET.workflow }}&job={{ request.GET.job }}"> All executions </a></td>
  <table cellpadding="0" cellspacing="0" border="0"
  class="table table-striped table-bordered" id="executions">
    <thead>
      <tr>
        <th width="5%">Execution</th>
        <th width="40%">Info</th>
        <th width="10%">Properties</th>
        <th width="12%">Exit Code</th>
        <th width="8%">Start</th>
        <th width="8%">End</th>
        <th width="9%">Run Time</th>
        <th width="8%">Logs</th>
      </tr>
    </thead>
    <tbody></tbody>
  </table>
</div>
{% endblock %}
