|
@@ -1,4 +1,3 @@
|
|
|
-
|
|
|
function varToggle(link, id) {
|
|
|
$('#v' + id).toggle();
|
|
|
var s = link.getElementsByTagName('span')[0];
|
|
@@ -218,9 +217,8 @@ function getQueryParams()
|
|
|
if (Sentry === undefined) {
|
|
|
var Sentry = {};
|
|
|
}
|
|
|
-(function(){
|
|
|
- var self = Sentry;
|
|
|
|
|
|
+(function(){
|
|
|
Sentry.options = {
|
|
|
urlPrefix: '',
|
|
|
mediaUrl: '/media/',
|
|
@@ -233,65 +231,161 @@ if (Sentry === undefined) {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
- Sentry.stream = {};
|
|
|
- Sentry.stream.clear = function(project_id) {
|
|
|
- if (confirm("Are you sure you want to mark all your stream as resolved?")) {
|
|
|
- $.ajax({
|
|
|
- url: Sentry.options.urlPrefix + '/api/' + project_id + '/clear/',
|
|
|
- type: 'post',
|
|
|
- dataType: 'json',
|
|
|
- success: function(groups){
|
|
|
- window.location.reload();
|
|
|
- }
|
|
|
- });
|
|
|
+ Sentry.prettyDate = function(date_str) {
|
|
|
+ // we need to zero out at CST
|
|
|
+ var time = Date.parse(date_str);
|
|
|
+ var now = new Date();
|
|
|
+ var now_utc = Date.UTC(
|
|
|
+ now.getUTCFullYear(),
|
|
|
+ now.getUTCMonth(),
|
|
|
+ now.getUTCDate(),
|
|
|
+ now.getUTCHours(),
|
|
|
+ now.getUTCMinutes(),
|
|
|
+ now.getUTCSeconds()
|
|
|
+ );
|
|
|
+
|
|
|
+ var seconds = (now_utc - time) / 1000;
|
|
|
+ // var offset = (new Date().getTimezoneOffset() - 300) * 60;
|
|
|
+ // seconds = seconds + offset;
|
|
|
+ var token = 'ago';
|
|
|
+ var time_formats = [
|
|
|
+ [60, 'just now', 'just now'], // 60
|
|
|
+ [120, '1 minute ago', '1 minute from now'], // 60*2
|
|
|
+ [3600, 'minutes', 60], // 60*60, 60
|
|
|
+ [7200, '1 hour ago', '1 hour from now'], // 60*60*2
|
|
|
+ [86400, 'hours', 3600], // 60*60*24, 60*60
|
|
|
+ [172800, 'yesterday', 'tomorrow'], // 60*60*24*2
|
|
|
+ [604800, 'days', 86400], // 60*60*24*7, 60*60*24
|
|
|
+ [1209600, 'last week', 'next week'], // 60*60*24*7*4*2
|
|
|
+ [2419200, 'weeks', 604800], // 60*60*24*7*4, 60*60*24*7
|
|
|
+ [4838400, 'last month', 'next month'], // 60*60*24*7*4*2
|
|
|
+ [29030400, 'months', 2419200], // 60*60*24*7*4*12, 60*60*24*7*4
|
|
|
+ [58060800, 'last year', 'next year'], // 60*60*24*7*4*12*2
|
|
|
+ [2903040000, 'years', 29030400], // 60*60*24*7*4*12*100, 60*60*24*7*4*12
|
|
|
+ [5806080000, 'last century', 'next century'], // 60*60*24*7*4*12*100*2
|
|
|
+ [58060800000, 'centuries', 2903040000] // 60*60*24*7*4*12*100*20, 60*60*24*7*4*12*100
|
|
|
+ ];
|
|
|
+ var list_choice = 1;
|
|
|
+
|
|
|
+ if (seconds < 0)
|
|
|
+ {
|
|
|
+ seconds = Math.abs(seconds);
|
|
|
+ token = 'from now';
|
|
|
+ list_choice = 2;
|
|
|
}
|
|
|
- };
|
|
|
- Sentry.stream.resolve = function(project_id, gid, remove){
|
|
|
- if (typeof(remove) == 'undefined') {
|
|
|
- remove = true;
|
|
|
+
|
|
|
+ for (var i=0, format; (format = time_formats[i]); i++) {
|
|
|
+ if (seconds < format[0])
|
|
|
+ {
|
|
|
+ if (typeof format[2] == 'string')
|
|
|
+ return format[list_choice];
|
|
|
+ else
|
|
|
+ return Math.floor(seconds / format[2]) + ' ' + format[1] + ' ' + token;
|
|
|
+ }
|
|
|
}
|
|
|
- $.ajax({
|
|
|
- url: Sentry.options.urlPrefix + '/api/' + project_id + '/resolve/',
|
|
|
- type: 'post',
|
|
|
- dataType: 'json',
|
|
|
- data: {
|
|
|
- gid: gid
|
|
|
- },
|
|
|
- success: function(groups){
|
|
|
- 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) {
|
|
|
- $('#event_list').prepend(data.html);
|
|
|
- $('#group_' + id).addClass('fresh');
|
|
|
- }
|
|
|
+ return time;
|
|
|
+ };
|
|
|
+
|
|
|
+ Sentry.prettyDates = function() {
|
|
|
+ $('.pretty-date').each(function(_, el){
|
|
|
+ var $el = $(el);
|
|
|
+ var title = $el.attr('title');
|
|
|
+ if (title) {
|
|
|
+ var date = Sentry.prettyDate(title);
|
|
|
+ if (date) {
|
|
|
+ $el.text(date);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
- Sentry.stream.bookmark = function(project_id, gid, el){
|
|
|
- $.ajax({
|
|
|
- url: Sentry.options.urlPrefix + '/api/' + project_id + '/bookmark/',
|
|
|
- type: 'post',
|
|
|
- dataType: 'json',
|
|
|
- data: {
|
|
|
- gid: gid
|
|
|
- },
|
|
|
- success: function(data){
|
|
|
- if (!el) {
|
|
|
- return;
|
|
|
- }
|
|
|
- var $el = $(el);
|
|
|
- if (data.bookmarked) {
|
|
|
- $el.addClass('checked');
|
|
|
- } else {
|
|
|
- $el.removeClass('checked');
|
|
|
- }
|
|
|
+
|
|
|
+ $(document).ready(function(){
|
|
|
+ $('.filter-list').each(function(_, el){
|
|
|
+ var $el = $(el);
|
|
|
+ if ($el.find('li').length > 6) {
|
|
|
+ // rebuild this widget as a dropdown select
|
|
|
+ var select = $('<select></select>');
|
|
|
+ var parent = $('<div class="filter-select sidebar-module">').appendTo($el.parent());
|
|
|
+
|
|
|
+ $el.find('li a').each(function(_, a){
|
|
|
+ a = $(a);
|
|
|
+ var opt = $('<option value="' + a.attr('href') + '">' + a.text() + '</option>').appendTo(select);
|
|
|
+ if (a.parent().hasClass('active')) {
|
|
|
+ opt.attr('selected', 'selected');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $el.remove();
|
|
|
+ select.appendTo(parent).change(function(){
|
|
|
+ window.location.href = $(this).val();
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
- };
|
|
|
|
|
|
+ // Update date strings periodically
|
|
|
+ setInterval(Sentry.prettyDates, 5000);
|
|
|
+ Sentry.prettyDates();
|
|
|
+ });
|
|
|
+
|
|
|
+ $(document).ajaxSend(function(event, xhr, settings) {
|
|
|
+ function getCookie(name) {
|
|
|
+ var cookieValue = null;
|
|
|
+ if (document.cookie && document.cookie !== '') {
|
|
|
+ var cookies = document.cookie.split(';');
|
|
|
+ for (var i = 0; i < cookies.length; i++) {
|
|
|
+ var cookie = jQuery.trim(cookies[i]);
|
|
|
+ // Does this cookie string begin with the name we want?
|
|
|
+ if (cookie.substring(0, name.length + 1) == (name + '=')) {
|
|
|
+ cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return cookieValue;
|
|
|
+ }
|
|
|
+ function sameOrigin(url) {
|
|
|
+ // url could be relative or scheme relative or absolute
|
|
|
+ var host = document.location.host; // host + port
|
|
|
+ var protocol = document.location.protocol;
|
|
|
+ var sr_origin = '//' + host;
|
|
|
+ var origin = protocol + sr_origin;
|
|
|
+ // Allow absolute or scheme relative URLs to same origin
|
|
|
+ return (url == origin || url.slice(0, origin.length + 1) == origin + '/') ||
|
|
|
+ (url == sr_origin || url.slice(0, sr_origin.length + 1) == sr_origin + '/') ||
|
|
|
+ // or any other URL that isn't scheme relative or absolute i.e relative.
|
|
|
+ !(/^(\/\/|http:|https:).*/.test(url));
|
|
|
+ }
|
|
|
+ function safeMethod(method) {
|
|
|
+ return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!safeMethod(settings.type) && sameOrigin(settings.url)) {
|
|
|
+ xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken'));
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ $('.popup').live('click', function(){
|
|
|
+ var $this = $(this);
|
|
|
+ var $window = $(window);
|
|
|
+ var $container = $($this.attr('data-container'));
|
|
|
+ var title = $this.attr('data-title') || 'Untitled';
|
|
|
+ var content = $container.html();
|
|
|
+ var height = Math.min($window.height() - 100, $container.height() + 40);
|
|
|
+ var width = Math.min($window.width() - 100, $container.width() + 40);
|
|
|
+ var w = window.open("about:blank", "dsqApiExpand", "toolbar=0,status=0,location=0,menubar=0,height=" + height + ",width=" + width);
|
|
|
+ w.document.write("<!DOCTYPE html><html>" +
|
|
|
+ "<head>" +
|
|
|
+ "<title>" + title + "</title>" +
|
|
|
+ "<link href=\"" + Sentry.options.popupCss + "\" rel=\"stylesheet\" type=\"text/css\"/>" +
|
|
|
+ "</head><body>" +
|
|
|
+ "<div id=\"popup\">" + content + "</div></body>" +
|
|
|
+ "</html>");
|
|
|
+ });
|
|
|
+
|
|
|
+}());
|
|
|
+if (Sentry === undefined) {
|
|
|
+ var Sentry = {};
|
|
|
+}
|
|
|
+(function(){
|
|
|
function getRankedPosition(list, value, idx) {
|
|
|
for (var i=0, item; (item = list[i]); i++) {
|
|
|
if (value > item[idx]) {
|
|
@@ -455,6 +549,14 @@ if (Sentry === undefined) {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ $(document).ready(function(){
|
|
|
+ Sentry.realtime.init();
|
|
|
+ });
|
|
|
+
|
|
|
+}());if (Sentry === undefined) {
|
|
|
+ var Sentry = {};
|
|
|
+}
|
|
|
+(function(){
|
|
|
Sentry.charts = {};
|
|
|
Sentry.charts.render = function(el, project_id, group_id, grid){
|
|
|
var $sparkline = $(el);
|
|
@@ -508,7 +610,10 @@ if (Sentry === undefined) {
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
-
|
|
|
+}());if (Sentry === undefined) {
|
|
|
+ var Sentry = {};
|
|
|
+}
|
|
|
+(function(){
|
|
|
Sentry.notifications = {};
|
|
|
Sentry.notifications.status = false;
|
|
|
|
|
@@ -547,8 +652,6 @@ if (Sentry === undefined) {
|
|
|
};
|
|
|
|
|
|
$(document).ready(function(){
|
|
|
- Sentry.realtime.init();
|
|
|
-
|
|
|
if (window.webkitNotifications){
|
|
|
Sentry.notifications.status = (window.webkitNotifications.checkPermission() > 0);
|
|
|
$('<li><a id="sentry_notify" href="javascript:void()">' + (Sentry.notifications.status ? 'Disable Notifications' : 'Enable Notifications') + '</a></li>').click(function(){
|
|
@@ -559,154 +662,67 @@ if (Sentry === undefined) {
|
|
|
}
|
|
|
}).prependTo('#account');
|
|
|
}
|
|
|
-
|
|
|
- $('.filter-list').each(function(_, el){
|
|
|
- var $el = $(el);
|
|
|
- if ($el.find('li').length > 6) {
|
|
|
- // rebuild this widget as a dropdown select
|
|
|
- var select = $('<select></select>');
|
|
|
- var parent = $('<div class="filter-select sidebar-module">').appendTo($el.parent());
|
|
|
-
|
|
|
- $el.find('li a').each(function(_, a){
|
|
|
- a = $(a);
|
|
|
- var opt = $('<option value="' + a.attr('href') + '">' + a.text() + '</option>').appendTo(select);
|
|
|
- if (a.parent().hasClass('active')) {
|
|
|
- opt.attr('selected', 'selected');
|
|
|
- }
|
|
|
- });
|
|
|
- $el.remove();
|
|
|
- select.appendTo(parent).change(function(){
|
|
|
- window.location.href = $(this).val();
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
});
|
|
|
-
|
|
|
- Sentry.prettyDate = function(date_str) {
|
|
|
- // we need to zero out at CST
|
|
|
- var time = Date.parse(date_str);
|
|
|
- var now = new Date();
|
|
|
- var now_utc = Date.UTC(
|
|
|
- now.getUTCFullYear(),
|
|
|
- now.getUTCMonth(),
|
|
|
- now.getUTCDate(),
|
|
|
- now.getUTCHours(),
|
|
|
- now.getUTCMinutes(),
|
|
|
- now.getUTCSeconds()
|
|
|
- );
|
|
|
-
|
|
|
- var seconds = (now_utc - time) / 1000;
|
|
|
- // var offset = (new Date().getTimezoneOffset() - 300) * 60;
|
|
|
- // seconds = seconds + offset;
|
|
|
- var token = 'ago';
|
|
|
- var time_formats = [
|
|
|
- [60, 'just now', 'just now'], // 60
|
|
|
- [120, '1 minute ago', '1 minute from now'], // 60*2
|
|
|
- [3600, 'minutes', 60], // 60*60, 60
|
|
|
- [7200, '1 hour ago', '1 hour from now'], // 60*60*2
|
|
|
- [86400, 'hours', 3600], // 60*60*24, 60*60
|
|
|
- [172800, 'yesterday', 'tomorrow'], // 60*60*24*2
|
|
|
- [604800, 'days', 86400], // 60*60*24*7, 60*60*24
|
|
|
- [1209600, 'last week', 'next week'], // 60*60*24*7*4*2
|
|
|
- [2419200, 'weeks', 604800], // 60*60*24*7*4, 60*60*24*7
|
|
|
- [4838400, 'last month', 'next month'], // 60*60*24*7*4*2
|
|
|
- [29030400, 'months', 2419200], // 60*60*24*7*4*12, 60*60*24*7*4
|
|
|
- [58060800, 'last year', 'next year'], // 60*60*24*7*4*12*2
|
|
|
- [2903040000, 'years', 29030400], // 60*60*24*7*4*12*100, 60*60*24*7*4*12
|
|
|
- [5806080000, 'last century', 'next century'], // 60*60*24*7*4*12*100*2
|
|
|
- [58060800000, 'centuries', 2903040000] // 60*60*24*7*4*12*100*20, 60*60*24*7*4*12*100
|
|
|
- ];
|
|
|
- var list_choice = 1;
|
|
|
-
|
|
|
- if (seconds < 0)
|
|
|
- {
|
|
|
- seconds = Math.abs(seconds);
|
|
|
- token = 'from now';
|
|
|
- list_choice = 2;
|
|
|
- }
|
|
|
-
|
|
|
- for (var i=0, format; (format = time_formats[i]); i++) {
|
|
|
- if (seconds < format[0])
|
|
|
- {
|
|
|
- if (typeof format[2] == 'string')
|
|
|
- return format[list_choice];
|
|
|
- else
|
|
|
- return Math.floor(seconds / format[2]) + ' ' + format[1] + ' ' + token;
|
|
|
- }
|
|
|
+}());if (Sentry === undefined) {
|
|
|
+ var Sentry = {};
|
|
|
+}
|
|
|
+(function(){
|
|
|
+ Sentry.stream = {};
|
|
|
+ Sentry.stream.clear = function(project_id) {
|
|
|
+ if (confirm("Are you sure you want to mark all your stream as resolved?")) {
|
|
|
+ $.ajax({
|
|
|
+ url: Sentry.options.urlPrefix + '/api/' + project_id + '/clear/',
|
|
|
+ type: 'post',
|
|
|
+ dataType: 'json',
|
|
|
+ success: function(groups){
|
|
|
+ window.location.reload();
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
- return time;
|
|
|
};
|
|
|
-
|
|
|
- Sentry.prettyDates = function() {
|
|
|
- $('.pretty-date').each(function(_, el){
|
|
|
- var $el = $(el);
|
|
|
- var title = $el.attr('title');
|
|
|
- if (title) {
|
|
|
- var date = Sentry.prettyDate(title);
|
|
|
- if (date) {
|
|
|
- $el.text(date);
|
|
|
+ Sentry.stream.resolve = function(project_id, gid, remove){
|
|
|
+ if (typeof(remove) == 'undefined') {
|
|
|
+ remove = true;
|
|
|
+ }
|
|
|
+ $.ajax({
|
|
|
+ url: Sentry.options.urlPrefix + '/api/' + project_id + '/resolve/',
|
|
|
+ type: 'post',
|
|
|
+ dataType: 'json',
|
|
|
+ data: {
|
|
|
+ gid: gid
|
|
|
+ },
|
|
|
+ success: function(groups){
|
|
|
+ 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) {
|
|
|
+ $('#event_list').prepend(data.html);
|
|
|
+ $('#group_' + id).addClass('fresh');
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
-
|
|
|
- $(function(){
|
|
|
- setInterval(Sentry.prettyDates, 5000);
|
|
|
- Sentry.prettyDates();
|
|
|
- });
|
|
|
-}());
|
|
|
-
|
|
|
-$(document).ajaxSend(function(event, xhr, settings) {
|
|
|
- function getCookie(name) {
|
|
|
- var cookieValue = null;
|
|
|
- if (document.cookie && document.cookie !== '') {
|
|
|
- var cookies = document.cookie.split(';');
|
|
|
- for (var i = 0; i < cookies.length; i++) {
|
|
|
- var cookie = jQuery.trim(cookies[i]);
|
|
|
- // Does this cookie string begin with the name we want?
|
|
|
- if (cookie.substring(0, name.length + 1) == (name + '=')) {
|
|
|
- cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
|
|
|
- break;
|
|
|
+ Sentry.stream.bookmark = function(project_id, gid, el){
|
|
|
+ $.ajax({
|
|
|
+ url: Sentry.options.urlPrefix + '/api/' + project_id + '/bookmark/',
|
|
|
+ type: 'post',
|
|
|
+ dataType: 'json',
|
|
|
+ data: {
|
|
|
+ gid: gid
|
|
|
+ },
|
|
|
+ success: function(data){
|
|
|
+ if (!el) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var $el = $(el);
|
|
|
+ if (data.bookmarked) {
|
|
|
+ $el.addClass('checked');
|
|
|
+ } else {
|
|
|
+ $el.removeClass('checked');
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- return cookieValue;
|
|
|
- }
|
|
|
- function sameOrigin(url) {
|
|
|
- // url could be relative or scheme relative or absolute
|
|
|
- var host = document.location.host; // host + port
|
|
|
- var protocol = document.location.protocol;
|
|
|
- var sr_origin = '//' + host;
|
|
|
- var origin = protocol + sr_origin;
|
|
|
- // Allow absolute or scheme relative URLs to same origin
|
|
|
- return (url == origin || url.slice(0, origin.length + 1) == origin + '/') ||
|
|
|
- (url == sr_origin || url.slice(0, sr_origin.length + 1) == sr_origin + '/') ||
|
|
|
- // or any other URL that isn't scheme relative or absolute i.e relative.
|
|
|
- !(/^(\/\/|http:|https:).*/.test(url));
|
|
|
- }
|
|
|
- function safeMethod(method) {
|
|
|
- return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
|
|
|
- }
|
|
|
-
|
|
|
- if (!safeMethod(settings.type) && sameOrigin(settings.url)) {
|
|
|
- xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken'));
|
|
|
- }
|
|
|
-});
|
|
|
-
|
|
|
-$('.popup').live('click', function(){
|
|
|
- var $this = $(this);
|
|
|
- var $window = $(window);
|
|
|
- var $container = $($this.attr('data-container'));
|
|
|
- var title = $this.attr('data-title') || 'Untitled';
|
|
|
- var content = $container.html();
|
|
|
- var height = Math.min($window.height() - 100, $container.height() + 40);
|
|
|
- var width = Math.min($window.width() - 100, $container.width() + 40);
|
|
|
- var w = window.open("about:blank", "dsqApiExpand", "toolbar=0,status=0,location=0,menubar=0,height=" + height + ",width=" + width);
|
|
|
- w.document.write("<!DOCTYPE html><html>" +
|
|
|
- "<head>" +
|
|
|
- "<title>" + title + "</title>" +
|
|
|
- "<link href=\"" + Sentry.options.popupCss + "\" rel=\"stylesheet\" type=\"text/css\"/>" +
|
|
|
- "</head><body>" +
|
|
|
- "<div id=\"popup\">" + content + "</div></body>" +
|
|
|
- "</html>");
|
|
|
-});
|
|
|
+ });
|
|
|
+ };
|
|
|
+}());
|