{% from "macros/breadcrumbs.html" import breadcrumbs_macro with context %}
{% from "macros/common_head.html" import common_head_macro with context %}
{% from "macros/header.html" import header_macro with context %}
<html>
  <head>
    <title>Tierkreis visualization: node</title>
      {{ common_head_macro() }}
  </head>
  <body>
    {{ header_macro() }}
    <main>
      {{ breadcrumbs_macro(breadcrumbs) }}

      <script>
        function openLink(path) {
          console.log(`${window.location.href}/${path}`);
          window.open(`${window.location.href}/${path}`, (target = "_blank"));
        }
      </script>
      <h1 class="fallback__title">{{ definition.function_name }}</h1>
    
      {% if  data.has_error %}
        <h2>Error</h2>
        <pre>{{ data.error_message}}</pre>
        <br>
      {% endif %}     
      <ul>
        <li>
          <span>Inputs</span>
          <ul>
            {% for input,path in definition.inputs.items() %}
            <li>
              <span class="divLink" onclick="openLink('inputs/{{ input }}')"
                >{{ input }}</span
              >
              ({{ path }})
            </li>
            {% endfor %}
          </ul>
        </li>

        <li>
          <span>Outputs</span>
          <ul>
            {% for output,path in definition.outputs.items() %}
            <li>
              <span class="divLink" onclick="openLink('outputs/{{ output }}')"
                >{{ output }}</span
              >
              ({{ path }})
            </li>
            {% endfor %}
          </ul>
        </li>
        <li><span class="divLink" onclick="openLink('logs')">logs</span></li>
      </ul>
    </main>
  </body>
</html>
