Skip to content

Commit

Permalink
Redesign event emails
Browse files Browse the repository at this point in the history
  • Loading branch information
dcramer committed Dec 16, 2013
1 parent 376f0c0 commit 23ea4c2
Show file tree
Hide file tree
Showing 7 changed files with 133 additions and 85 deletions.
9 changes: 7 additions & 2 deletions src/sentry/plugins/sentry_mail/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ def send_test_mail(self, project=None):
def get_notification_settings_url(self):
return absolute_uri(reverse('sentry-account-settings-notifications'))

def get_project_url(self, project):
return absolute_uri(reverse('sentry-stream', args=[
project.team.slug,
project.slug,
]))

def on_alert(self, alert):
project = alert.project
subject = '[{0}] ALERT: {1}'.format(
Expand All @@ -73,7 +79,6 @@ def on_alert(self, alert):
context = {
'alert': alert,
'link': alert.get_absolute_url(),
'settings_link': self.get_notification_settings_url(),
}

headers = {
Expand Down Expand Up @@ -173,9 +178,9 @@ def notify_users(self, group, event, fail_silently=False):
context = {
'group': group,
'event': event,
'tags': event.get_tags(),
'link': link,
'interfaces': interface_list,
'settings_link': self.get_notification_settings_url(),
}

headers = {
Expand Down
129 changes: 89 additions & 40 deletions src/sentry/templates/sentry/emails/base.html
Original file line number Diff line number Diff line change
@@ -1,25 +1,36 @@
{% load sentry_helpers %}
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
* { font-size: 12px; }
body, .main {
width: 100%;
font-family: "helvetica neue", helvetica, sans-serif;
font-size: 14px;
font-family: "Helvetica Neue", helvetica, sans-serif;
border: 0;
padding: 0;
margin: 0;
}
* {
font-weight: 200;
}
pre {
word-break: break-all;
word-wrap: break-word;
white-space: pre;
white-space: pre-wrap;
white-space: -moz-pre-wrap;
white-space: -o-pre-wrap;
margin-bottom: 15px;
}
a {
color: #278ced;
font-weight: bold;
text-decoration: none;
}
pre, code {
font-size: 11px;
font-size: 14px;
font-weight: normal;
font-family: Menlo, Monaco, "Courier New", monospace;
}
table {
Expand All @@ -33,54 +44,68 @@
text-align: center;
}
.body {
max-width: 600px;
margin: 0 auto;
text-align: left;
border: 5px solid #404f60;
}
.header {
background: #404f60;
color: #fff;
padding: 10px;
padding: 20px 0;
font-size: 14px;
height: 28px;
margin-bottom: 20px;
border-bottom: 2px solid #eee;
}
.count {
color: #fff;
.header .btn {
float: right;
margin: -18px -10px 0 10px;
-moz-border-radius: 60px;
-webkit-border-radius: 60px;
border-radius: 60px;
width: 60px;
height: 60px;
background: #cfd3da;
line-height: 62px;
text-align: center;
font-size: 16px;
font-weight: 400;
font-family: "proxima nova", "proxima-nova", "heletica-neue", sans-serif;
}
.level-debug .count {}
.level-info .count { background: #ffa101; }
.level-warning .count { background: #ffa101; }
.level-error .count { background: #f0431c; }
.level-fatal .count { background: #f0431c; }
color: #fff;
background: #f43f20;
padding: 8px 15px;
line-height: 18px;
margin: 4px 0;
font-weight: normal;
border-radius: 4px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
}
.header h1 {
float: left;
font-size: 22px;
margin: 0;
padding: 0;
font-weight: normal;
font-size: 38px;
line-height: 42px;
color: #000;
letter-spacing: -1px;
}
.header h1 small {
font-size: 14px;
margin-left: 10px;
color: #ccc;
font-weight: normal;
}
.footer {
border-top: 2px solid #eee;
padding: 40px 0;
}

h2 {
font-size: 20px;
font-weight: 500;
margin: 0 0 20px;
}
h2 .highlight {
background: #eee;
color: #000;
padding: 0 5px;
}

h3 {
font-size: 18px;
font-weight: 500;
margin: 0 0 20px;
}

.inner {
background: #fff;
padding: 10px;
padding: 10px 0;
}
.inner pre,
.inner p,
Expand All @@ -90,20 +115,37 @@
.inner table th,
.inner table td {
text-align: left;
padding: 5px 0;
}
.metadata table {
width: 600px;
.inner table th {
min-width: 60px;
color: #666;
}
pre.message {
margin-bottom: 30px;
}
.interface {
margin-bottom: 15px;
margin-bottom: 30px;
}
.interface .title {
color: #404f60;
font-size: 14px;
padding-bottom: 5px;
margin-bottom: 5px;
border-bottom: 1px solid #404f60;
font-weight: bold;
margin-bottom: 15px;
}
.tag-list {
list-style: none;
margin: 0 0 30px;
padding: 0;
}
.tag-list li {
display: inline;
background: #eee;
padding: 2px 5px;
margin-right: 10px;
border-radius: 4px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
}
.tag-list li strong {
font-weight: 200;
}
</style>
</head>
Expand All @@ -123,6 +165,13 @@ <h1>Sentry</h1>
<p>This is the body of an email</p>
{% endblock %}
</div>
<div class="footer">
{% block footer %}
<a href="{% absolute_uri %}" style="float:right">Home</a>
{% url 'sentry-account-settings-notifications' as settings_link %}
<a href="{% absolute_uri settings_link %}">Notification Settings</a>
{% endblock %}
</div>
</div>
{% endblock %}
</td>
Expand Down
58 changes: 24 additions & 34 deletions src/sentry/templates/sentry/emails/error.html
Original file line number Diff line number Diff line change
@@ -1,51 +1,41 @@
{% extends "sentry/emails/base.html" %}

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

{% block bodyclass %} level-{{ event.get_level_display }}{% endblock %}

{% block header %}
<h1>Sentry <small>
<a href="{{ link }}" class="btn">View on Sentry</a>
<h1>Sentry</h1>
{% endblock %}

{% block inner %}
<h2>
{% url 'sentry-stream' group.project.team.slug group.project.slug as project_link %}
{% if group.times_seen == 1 %}
{% trans "New Event" %}
New Event on <a href="{% absolute_uri project_link %}" class="highlight">{{ group.project.name }}</a>
{% else %}
{% trans "Regression" %}
Regression on <a href="{% absolute_uri project_link %}" class="highlight">{{ group.project.name }}</a>
{% endif %}
</small></h1>
{% endblock %}
</h2>

{% block inner %}
<pre>{{ event.message }}</pre>
<pre class="message">{{ event.message }}</pre>

<p><a href="{{ link }}">{{ link }}</a></p>
<h3>Tags</h3>

<table class="metadata">
<colgroup>
<col style="width:25%;">
<col style="width:25%;">
<col style="width:25%;">
<col style="width:25%;">
</colgroup>
<tr>
<th>{% trans "Logger:" %}</th>
<td>{{ event.logger }}</td>
<th>{% trans "Level:" %}</th>
<td>{{ event.get_level_display }}</td>
</tr>
<tr>
<th>{% trans "Server:" %}</th>
<td>{{ event.server_name }}</td>
<th>{% trans "First Seen:" %}</th>
<td>{{ group.first_seen|date }}</td>
</tr>
</table>
<ul class="tag-list">
{% for tag_key, tag_value in tags %}
<li>
<strong>{{ tag_key }}</strong>
<em>=</em>
<span><a href="{% url 'sentry-stream' group.team.slug group.project.slug %}?{{ tag_key }}={{ tag_value }}">{{ tag_value }}</a> {% if tag_value|is_url %}<a href="{{ tag_value }}" class="icon-share"></a>{% endif %}</span>
</li>
{% endfor %}
</ul>

{% for int_id, label, text in interfaces %}
{% for label, text in interfaces %}
<div class="interface">
<div class="title">{{ label }}</div>
<h3 class="title">{{ label }}</h3>
{{ text }}
</div>
{% endfor %}

<p><a href="{{ settings_link }}">Notification Settings</a></p>
{% endblock %}
3 changes: 2 additions & 1 deletion src/sentry/templates/sentry/partial/_event_details.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ <h2>Tags</h2>
<li>
<strong>{{ tag_key }}</strong>
<em>=</em>
<span><a href="{% url 'sentry-stream' group.team.slug group.project.slug %}?{{ tag_key }}={{ tag_value }}">{{ tag_value }}</a> {% if tag_value|is_url %}<a href="{{ tag_value }}" class="icon-share"></a>{% endif %}</span></li>
<span><a href="{% url 'sentry-stream' group.team.slug group.project.slug %}?{{ tag_key }}={{ tag_value }}">{{ tag_value }}</a> {% if tag_value|is_url %}<a href="{{ tag_value }}" class="icon-share"></a>{% endif %}</span>
</li>
{% endfor %}
</ul>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
{% load i18n %}
<table>
<colgroup>
<col style="width:60px;">
</colgroup>
<tbody>
<tr>
<th>{% trans "URL:" %}</th>
<th>{% trans "URL" %}</th>
<td><a href="{{ url }}{% if query_string %}?{{ query_string }}{% endif %}">{{ url }}</a></td>
</tr>
{% if method %}
<tr>
<th>{% trans "Method:" %}</th>
<th>{% trans "Method" %}</th>
<td>{{ method }}</td>
</tr>
{% endif %}
<tr>
<th>{% trans "Query:" %}</th>
<th>{% trans "Query" %}</th>
<td>
<code>{{ query_string|pprint }}</code>
</td>
Expand Down
4 changes: 4 additions & 0 deletions src/sentry/utils/samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ def load_data(platform):
"id": "1671",
"email": "foo@example.com"
}
data['tags'] = [
('foo', 'bar'),
('version', '1.0'),
]
data['sentry.interfaces.Http'] = {
"cookies": {},
"url": "http://example.com/foo",
Expand Down
6 changes: 4 additions & 2 deletions src/sentry/web/frontend/debug/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ def html_body(self):
def new_event(request):
team = Team(
slug='example',
name='Example',
)
project = Project(
slug='example',
name='Example',
team=team,
)
group = Group(
Expand Down Expand Up @@ -52,9 +54,9 @@ def new_event(request):
context={
'group': group,
'event': event,
'link': '#link',
'link': 'http://example.com/link',
'interfaces': interface_list,
'settings_link': '#settings-link',
'tags': event.get_tags(),
},
)

Expand Down

0 comments on commit 23ea4c2

Please sign in to comment.