{#
 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/dag.html" %}
{% from 'appbuilder/custom_icons.html' import icon %}

{% block content %}
  {{ super() }}
  <hr>
  <br>
  <h4>
    <span class="text-muted">Task Instance:</span> <span>{{ task_id }}</span>
    <span class="text-muted">at</span> <time datetime="{{ execution_date }}">{{ execution_date }}</time>
    {% if map_index is defined and map_index >= 0 %}
      <span class="text-muted">Map Index:</span> <span>{{ map_index }}</span>
    {% endif %}
  </h4>
  <ul class="nav nav-pills">
    {% macro ti_url(endpoint) -%}
      {% if map_index >= 0 -%}
        {{ url_for(endpoint, dag_id=dag.dag_id, task_id=task_id, execution_date=execution_date, map_index=map_index) }}
      {%- else -%}
        {{ url_for(endpoint, dag_id=dag.dag_id, task_id=task_id, execution_date=execution_date) }}
      {%- endif -%}
    {% endmacro -%}
    <li><a href="{{ ti_url('Airflow.task') }}">
        <span class="material-icons" aria-hidden="true">details</span>
      Task Instance Details</a></li>
    <li><a href="{{ ti_url('Airflow.rendered_templates') }}">
        <span class="material-icons" aria-hidden="true">code</span>
      Rendered Template</a></li>
    {% if k8s_or_k8scelery_executor %}
      <li><a href="{{ ti_url('Airflow.rendered_k8s') }}">
        {{ icon('kubernetes') }}
        K8s Pod Spec</a></li>
    {% endif %}
    <li><a href="{{ ti_url('Airflow.log') }}">
        <span class="material-icons" aria-hidden="true">reorder</span>
      Log</a></li>
    <li><a href="{{ ti_url('Airflow.xcom') }}">
        <span class="material-icons" aria-hidden="true">sync_alt</span>
      XCom</a></li>
  </ul>
  <br>
{% endblock %}
