{#
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
 distributed with this work for additional information
 regarding copyright ownership.  The ASF licenses this file
 to you under the Apache License, Version 2.0 (the
 "License"); you may not use this file except in compliance
 with the License.  You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing,
 software distributed under the License is distributed on an
 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
#}

{% extends "airflow/task_instance.html" %}
{% block title %}DAGs - {{ appbuilder.app_name }}{% endblock %}

{% block content %}
  {{ super() }}
  <h4>{{ title }}</h4>
  <h5>Dependencies Blocking Task From Getting Scheduled</h5>
  <table class="table table-striped table-bordered">
    <tr>
      <th>Dependency</th>
      <th>Reason</th>
    </tr>
    {% for dependency, reason in failed_dep_reasons|sort %}
      <tr>
        <td>{{ dependency }}</td>
        {% autoescape false %}
          <td class="code">{{ reason }}</td>
        {% endautoescape %}
      </tr>
    {% endfor %}
  </table>
  <div>
    {% for attr, value in special_attrs_rendered.items() %}
      {% if value %}
        <h5>Attribute: {{ attr }}</h5>
        {{ value }}
      {% endif %}
    {% endfor %}
    {% if ti_attrs is none %}
      <h5>No Task Instance Available</h5>
    {% else %}
      <h5>Task Instance Attributes</h5>
      <table class="table table-striped table-bordered">
        <tr>
          <th>Attribute</th>
          <th>Value</th>
        </tr>
        {% for attr, value in ti_attrs %}
          <tr>
            <td>{{ attr }}</td>
            <td class="code js-ti-attr">{{ value }}</td>
          </tr>
        {% endfor %}
      </table>
    {% endif %}
    <h5>Task Attributes</h5>
    <table class="table table-striped table-bordered">
      <tr>
        <th>Attribute</th>
        <th>Value</th>
      </tr>
      {% for attr, value in task_attrs %}
        <tr>
          <td>{{ attr }}</td>
          <td class="code wrap">{{ value }}</td>
        </tr>
      {% endfor %}
    </table>
  </div>
{% endblock %}

{% block tail %}
  {{ super() }}
  <script src="{{ url_for_asset('task.js') }}"></script>
{% endblock %}
