Skip to content

Commit

Permalink
Merge branch 'master' of github.com:dcramer/django-sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
dz committed Sep 1, 2010
2 parents 37a002a + 7e18cf8 commit 040c331
Showing 3 changed files with 23 additions and 12 deletions.
16 changes: 9 additions & 7 deletions sentry/media/scripts/global.js
Original file line number Diff line number Diff line change
@@ -65,11 +65,13 @@ function sentryResolve(gid, remove){
gid: gid,
},
success: function(groups){
for (var gid in groups) {
if (remove) {
$('#group_' + gid).remove();
} else {
$('#group_' + gid + ' .resolve-link').remove();
for (var i=groups.length-1, el, row; (el=groups[i]); i--) {
var id = el[0];
var data = el[1];
$('#group_' + id).remove();
if (!remove) {
$('#message_list').prepend(data.html);
$('#group_' + id).addClass('fresh');
}
}
}
@@ -97,11 +99,11 @@ function sentryRefresh(){
row.remove();
$('#message_list').prepend(data.html);
if (row.attr('data-sentry-count') != data.count) {
$('#group_' + el[0]).addClass('fresh');
$('#group_' + id).addClass('fresh');
}
} else {
$('#message_list').prepend(data.html);
$('#group_' + el[0]).addClass('fresh')
$('#group_' + id).addClass('fresh')
}
}
$('#message_list .fresh').css('background-color', '#ccc').animate({backgroundColor: '#fff'}, 1200, function() {
2 changes: 1 addition & 1 deletion sentry/templates/sentry/group.html
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ <h2>Servers</h2>
</div>

<div id="body" class="with-sidebar">
<ul class="messages">
<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>
17 changes: 13 additions & 4 deletions sentry/views.py
Original file line number Diff line number Diff line change
@@ -99,8 +99,6 @@ def ajax_handler(request):
server_name = request.GET.get('server_name') or ''
level = request.GET.get('level') or ''

realtime = not (request.GET.get('p') > 1)

if logger not in logger_names:
logger = ''

@@ -138,8 +136,19 @@ def ajax_handler(request):
gid = request.POST.get('gid')
if not gid:
return HttpResponseForbidden()
GroupedMessage.objects.filter(pk=gid).update(status=1)
data = {gid: 1}
try:
group = GroupedMessage.objects.get(pk=gid)
except GroupedMessage.DoesNotExist:
return HttpResponseForbidden()

GroupedMessage.objects.filter(pk=group.pk).update(status=1)
group.status = 1

data = [
(m.pk, {
'html': render_to_string('sentry/partial/_group.html', {'group': m}),
'count': m.times_seen,
}) for m in [group]]

response = HttpResponse(simplejson.dumps(data))
response['Content-Type'] = 'application/json'

0 comments on commit 040c331

Please sign in to comment.