{% extends "base.html" %}
{% block body %}

    {% from 'info_panel.html' import info_panel %}

    {% call info_panel() %}
        {% if files %}
            <p>Click on a file to view all the functions in that file (some of which may not be listed here).</p>
            <p>Click on a function name to view calls to that function.</p>
            <p>Click on the <i class="glyphicon glyphicon-play-circle"></i> icon
                to view the most recent call to that function.</p>
        {% else %}
            <p>You haven't traced any functions! Decorate a function with <code>@eye</code> to get started:</p>
            <pre id="example-code">
from birdseye import eye

@eye
def foo():</pre>
            <p>Read more documentation
                <a href="https://birdseye.readthedocs.io/en/latest/quickstart.html">here</a>.
            </p>
            <script src="{{ url_for('static', filename='js/libs/highlight.pack.js') }}"></script>
            <link rel="stylesheet" href="{{ url_for('static', filename='css/hljs.min.css') }}">
            <script>
                hljs.highlightBlock(document.getElementById("example-code"));
            </script>
        {% endif %}
    {% endcall %}

    <ul class="no-bullet">
        {% for full, calls in files.items() %}
            <li>
                <a href="{{ url_for('file_view', path=full) }}">
                    <i class="glyphicon glyphicon-file"></i>
                    {{ short(full) }}
                </a>
                {% if calls %}
                    <ul class="no-bullet">
                        {% for (func_name, row) in calls.items() %}
                            <li>
                                <a href="{{ url_for('call_view', call_id=row.id) }}">
                                    <i class="glyphicon glyphicon-play-circle"></i>
                                </a>
                                <a href="{{ url_for('func_view', path=full, func_name=func_name) }}">
                                    {% if row.type == 'function' %}
                                        {{ func_name }}
                                    {% elif row.type == 'class' %}
                                        class {{ func_name }}
                                    {% else %}
                                        Execution of module
                                    {% endif %}
                                </a>
                            </li>
                        {% endfor %}
                    </ul>
                {% endif %}
            </li>
        {% endfor %}
    </ul>
{% endblock %}