{% load i18n sizeformat %}

<div class="detail">
  <dl class="dl-horizontal">
    <dt>{% trans "Status" %}</dt>
    <dd>{{ job_execution.info.status }}</dd>
    <dt>{% trans "ID" %}</dt>
    <dd>{{ job_execution.id }}</dd>
    <dt>{% trans "Project ID" %}</dt>
    {% if job_execution.tenant_id %}
    <dd>{{ job_execution.tenant_id }}</dd>
    {% else %}
    <dd>{{ job_execution.project_id }}</dd>
    {% endif %}
    <dt>{% trans "Job Template" %}</dt>
    <dd>
    {% if job_execution.job_id %}
    <a href="{% url 'horizon:project:data_processing.jobs:jt-details' job_execution.job_id %}">
    {% else %}
    <a href="{% url 'horizon:project:data_processing.jobs:jt-details' job_execution.job_template_id %}">
    {% endif %}
    {{ object_names.job_name }}
    </a>
    </dd>
    <dt>{% trans "Public" %}</dt>
    <dd>{{ job_execution.is_public|yesno }}</dd>
    <dt>{% trans "Protected" %}</dt>
    <dd>{{ job_execution.is_protected|yesno }}</dd>
    {% if job_execution.input_id %}
      <dt>{% trans "Input Data Source" %}</dt>
      <dd><a href="{% url 'horizon:project:data_processing.jobs:ds-details' job_execution.input_id %}">{{ object_names.input_name }}</a> ({{ object_names.input_url }})</dd>
    {% endif %}
    {% if job_execution.output_id %}
      <dt>{% trans "Output Data Source" %}</dt>
      <dd><a href="{% url 'horizon:project:data_processing.jobs:ds-details' job_execution.output_id %}">{{ object_names.output_name }}</a> ({{ object_names.output_url }})</dd>
    {% endif %}
    <dt>{% trans "Cluster" %}</dt>
    <dd><a href="{% url 'horizon:project:data_processing.clusters:cluster-details' job_execution.cluster_id %}">{{ object_names.cluster_name }}</a></dd>
    <dt>{% trans "Last Updated" %}</dt>
    <dd>{{ job_execution.updated_at|parse_isotime }}</dd>
    <dt>{% trans "Started" context "Start time" %}</dt>
    <dd>{{ job_execution.start_time|parse_isotime }}</dd>
    <dt>{% trans "Ended" context "End time" %}</dt>
    <dd>{{ job_execution.end_time|parse_isotime }}</dd>
    <dt>{% trans "Return Code" %}</dt>
    <dd>{{ job_execution.return_code }}</dd>
    <dt>{{ job_execution_engine_job_attr_pretty }}</dt>
    <dd>{{ job_execution_engine_job_id }}</dd>
    <dt>{% trans "Created" context "Created time" %}</dt>
    <dd>{{ job_execution.created_at|parse_isotime }}</dd>
    <dt>{% trans "Job Configuration" %}</dt>
    <dd>{% for group, vals in job_execution.job_configs.iteritems %}
        <ul><li><span style="font-weight:bold">{% blocktrans %}{{ group }}:{% endblocktrans %}</span>
          {% if group == "args" %}
            <ul>{% for val in vals %} <li>{{ val }}</li> {% endfor %}</ul>
          {% else %}
            <ul>{% for key, val in vals.iteritems %} <li>{{ key }} = {{ val }}</li> {% endfor %}</ul>
          {% endif %}
        </li></ul>
        {% endfor %}
    </dd>
  </dl>
</div>
