{% extends "sentry/index.html" %}

{% load sentry_helpers %}

{% block title %}{{ group.error }} | Django Sentry{% endblock %}

{% block body %}
	<div id="header">
		<div class="container">
			<h1><a href="{% url sentry %}"><span class="sentry-logo" title="Django Sentry"><img src="{% url sentry-media "images/sentry.png" %}" border=0/></span></a></h1>
			<h2>Message Details</h2>
			<a class="backlink" href="{% url sentry %}">&laquo; back to list</a>
		</div>
	</div> 
	<div id="content">
		<div class="container">
			<div id="sidebar">
				{% if chart_url %}
					<h2>Last 24 Hours</h2>
		
					<img src="{{ chart_url }}" class="chart" alt="chart"/>
				{% endif %}
				
				<h2>Meta</h2>
		
				<dl class="flat">
					<dt>First Seen:</dt>
					<dd>{{ group.first_seen }}</dd>
					<dt>Last Seen:</dt>
					<dd>{{ group.last_seen }}</dd>
					<dt>Status:</dt>
					<dd>{{ group.get_status_display|title }}</dd>
				</dl>

				{% if unique_servers %}
					<h2>Servers</h2>
		
					<ul class="server-list">
						{% for server, priority in unique_servers|with_priority:"times_seen" %}
							<li class="priority-{{ priority }}"><span class="count">{{ server.times_seen }}</span> {{ server.server_name }}</li>
						{% endfor %}
					</ul>
				{% endif %}

				{% if unique_urls %}
					<h2>URLs</h2>
		
					<ul class="url-list">
						{% for link, priority in unique_urls|with_priority:"times_seen" %}
							<li class="priority-{{ priority }}"><span class="count">{{ link.times_seen }}</span> <a href="{{ link.url }}">{{ link.url }}</a></li>
						{% endfor %}
					</ul>
				{% endif %}
			</div>

			<div id="body" class="with-sidebar">
				<ul class="messages" id="message_list">
					<li class="{% cycle 'row1' 'row2' %} level-{{ group.level }} active" id="group_{{ group.pk }}" data-sentry-count="{{ group.times_seen }}">
						<span class="count count-digits-{{ group.times_seen|num_digits }}">{{ group.times_seen }}</span>
						<h3>{% if group.view %}{{ group.view }}{% else %}{{ group.message }}{% endif %}</h3>
						<span class="last_seen">{{ group.last_seen|timesince }} ago</span>
						<span class="status status-{{ group.status }}">{{ group.get_status_display }}</span>
						<p class="message"><span class="tag tag-level">{{ group.get_level_display }}</span> {{ group.error }}</p>
						<pre class="traceback">{{ group.shortened_traceback }}</pre>
						{% if group.status == 0 %}
							<a href="{% url sentry-ajax %}?op=resolve&amp;gid={{ group.pk }}" class="hidden button button_resolve">&#10003;</a>
						{% endif %}
					</li>
				</ul>
		
				{% if traceback %}

					<h2>Sample Traceback</h2>

					{{ traceback }}

				{% endif %}
				
				<div id="requestinfo">
					<h2>Request information</h2>
				  
					{% for k, v in json_data %}
						<h3 id="get-info">{{ k }}</h3>
						{% if v %}
							{% if v|is_dict %}
								<table class="req">
									<thead>
										<tr>
											<th>Variable</th>
											<th>Value</th>
										</tr>
									</thead>
									<tbody>
										{% for k_, v_ in v.iteritems %}
										<tr>
											<td>{{ k_ }}</td>
											<td class="code"><div>{{ v_|pprint }}</div></td>
										</tr>
										{% endfor %}
									</tbody>
								</table>
							{% else %}
								{{ v|pprint }}
							{% endif %}
						{% else %}
							<p>No data for {{ k }}</p>
						{% endif %}
					{% endfor %}
				</div>
			</div>
		</div>
	</div>
	<div id="footer">
		<div class="container">
			Powered by sexy Django magic.
		</div>	
	</div> 
{% endblock %}
