{% extends "sentry/group/details.html" %}

{% load i18n %}
{% load sentry_helpers %}

{% block title %}{{ group.error }} | {{ block.super }}{% endblock %}

{% block inner %}
    <ul class="messages" id="message_list">
        <li class="row1 active level-{{ message.level }}" data-sentry-count="{{ message.times_seen }}">
            <h3>
                {{ message.message_top|truncatechars:100 }}
                {% if message.url %}
                     on {{ message.url }}
                {% endif %}
            </h3>
            <span class="status status-{{ message.status }}">{{ message.get_status_display }}</span>
            <p class="message">
                {% if message.message_id %}
                    <span class="tag tag-id">{{ message.message_id }}</span>
                {% endif %}
                <span class="tag tag-level">{{ message.get_level_display }}</span>
                <span class="tag tag-server">{{ message.server_name }}</span>
                {% with message.get_version as version %}
                    {% if version %}
                        <span class="tag tag-version">{{ version.0 }} {{ version.1 }}</span> 
                    {% endif %}
                {% endwith %}
                <span class="last_seen">{{ message.datetime|timesince }}</span>
            </p>
        </li>
    </ul>

    {% if message.has_two_part_message %}
        <h2>{% trans "Full Message" %}</h2>
        <pre id="full-message">{{ message.message }}</pre>
    {% endif %}

    {% if traceback %}
        {{ traceback }}
    {% endif %}

    <div id="requestinfo">
        <h2>{% trans "Additional Data" %}</h2>
        <table>
            {% for k, v in json_data %}
                <tr>
                    <th class="key">{{ k }}</th>
                    <td class="values">
                    {% if v %}
                        {% if v|is_dict %}
                            <table class="vars">
                                <thead>
                                    <tr>
                                        <th>{% trans "Variable" %}</th>
                                        <th>{% trans "Value" %}</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    {% for k_, v_ in v.iteritems|as_sorted %}
                                    <tr>
                                        <td>{{ k_ }}</td>
                                        <td class="code"><pre>{{ v_|pprint }}</pre></td>
                                    </tr>
                                    {% endfor %}
                                </tbody>
                            </table>
                        {% else %}
                            <pre>{{ v|pprint }}</pre>
                        {% endif %}
                    {% else %}
                        <p>{% blocktrans with k as varname %}No data for {{ varname }}{% endblocktrans %}</p>
                    {% endif %}
                    </td>
                </tr>
            {% endfor %}
        </table>
    </div>
{% endblock %}