Commit dcd7b2419e105d6dcef38101807e3c523beb0b52
1 parent
1265b058
Exists in
master
and in
1 other branch
Some tweaks before merging ui-updates
Showing
8 changed files
with
61 additions
and
24 deletions
Show diff stats
app/helpers/notices_helper.rb
@@ -5,7 +5,6 @@ module NoticesHelper | @@ -5,7 +5,6 @@ module NoticesHelper | ||
5 | end | 5 | end |
6 | 6 | ||
7 | def line_number_with_link(app, line) | 7 | def line_number_with_link(app, line) |
8 | - return " ".html_safe if line['number'].blank? | ||
9 | if Notice.in_app_backtrace_line?(line) | 8 | if Notice.in_app_backtrace_line?(line) |
10 | return link_to_github(app, line, line['number']) if app.github_url? | 9 | return link_to_github(app, line, line['number']) if app.github_url? |
11 | if app.issue_tracker && app.issue_tracker.respond_to?(:url_to_file) | 10 | if app.issue_tracker && app.issue_tracker.respond_to?(:url_to_file) |
app/models/err.rb
app/models/error_report.rb
1 | require 'digest/md5' | 1 | require 'digest/md5' |
2 | +require 'hoptoad_notifier' | ||
2 | 3 | ||
3 | class ErrorReport | 4 | class ErrorReport |
4 | attr_reader :klass, :message, :backtrace, :request, :server_environment, :api_key, :notifier | 5 | attr_reader :klass, :message, :backtrace, :request, :server_environment, :api_key, :notifier |
app/views/notices/_backtrace.html.haml
1 | .window | 1 | .window |
2 | %table.backtrace | 2 | %table.backtrace |
3 | - lines.each do |line| | 3 | - lines.each do |line| |
4 | - - in_app = line['file'].gsub!('[PROJECT_ROOT]','') && !line['file'].match(/^\/vendor\//) | ||
5 | - - path = File.dirname(line['file']) + '/' | 4 | + - path = File.dirname(line['file']) |
5 | + - path = path == "." ? "" : path + '/' | ||
6 | - file = File.basename(line['file']) | 6 | - file = File.basename(line['file']) |
7 | - %tr{:class => (in_app ? 'in-app' : nil)} | ||
8 | - %td.line | 7 | + %tr |
8 | + %td.line{:class => (Notice.in_app_backtrace_line?(line) ? 'in-app' : nil)} | ||
9 | %span.path>= path | 9 | %span.path>= path |
10 | - %span.file= "#{file}:" << line_number_with_link(@app, line) | 10 | + %span.file= line['number'].blank? ? file : ("#{file}:" << line_number_with_link(@app, line)).html_safe |
11 | → | 11 | → |
12 | %span.method= line['method'] | 12 | %span.method= line['method'] |
13 | 13 |
config/application.rb
@@ -21,7 +21,7 @@ module Errbit | @@ -21,7 +21,7 @@ module Errbit | ||
21 | # -- all .rb files in that directory are automatically loaded. | 21 | # -- all .rb files in that directory are automatically loaded. |
22 | 22 | ||
23 | # Custom directories with classes and modules you want to be autoloadable. | 23 | # Custom directories with classes and modules you want to be autoloadable. |
24 | - config.autoload_paths += [Rails.root.join("app/models/issue_trackers")] | 24 | + config.autoload_paths += [Rails.root.join("app/models/issue_trackers"), Rails.root.join('lib')] |
25 | 25 | ||
26 | # Only load the plugins named here, in the order given (default is alphabetical). | 26 | # Only load the plugins named here, in the order given (default is alphabetical). |
27 | # :all can be used as a placeholder for all plugins not explicitly named. | 27 | # :all can be used as a placeholder for all plugins not explicitly named. |
db/migrate/20110905134638_link_errs_to_problems.rb
@@ -16,8 +16,8 @@ class LinkErrsToProblems < Mongoid::Migration | @@ -16,8 +16,8 @@ class LinkErrsToProblems < Mongoid::Migration | ||
16 | end | 16 | end |
17 | end | 17 | end |
18 | 18 | ||
19 | - Rake::Task["errbit:db:update_notices_count"].invoke | ||
20 | Rake::Task["errbit:db:update_problem_attrs"].invoke | 19 | Rake::Task["errbit:db:update_problem_attrs"].invoke |
20 | + Rake::Task["errbit:db:update_notices_count"].invoke | ||
21 | end | 21 | end |
22 | 22 | ||
23 | def self.down | 23 | def self.down |
lib/overrides/hoptoad_notifier/hoptoad_notifier.rb
@@ -15,8 +15,11 @@ HoptoadNotifier.module_eval do | @@ -15,8 +15,11 @@ HoptoadNotifier.module_eval do | ||
15 | end | 15 | end |
16 | notice.send("api_key=", app.api_key) | 16 | notice.send("api_key=", app.api_key) |
17 | # Create notice internally. | 17 | # Create notice internally. |
18 | - # 'to_xml ~> from_xml' provides a data bridge between hoptoad_notifier and Errbit. | ||
19 | - ::Notice.from_xml(notice.to_xml) | 18 | + debugger |
19 | + | ||
20 | + report = ErrorReport.new(notice.to_xml) | ||
21 | + report.generate_notice! | ||
22 | + | ||
20 | logger.info "Internal error was logged to 'Self.Errbit' app." | 23 | logger.info "Internal error was logged to 'Self.Errbit' app." |
21 | end | 24 | end |
22 | end | 25 | end |
public/stylesheets/application.css
@@ -664,20 +664,60 @@ table.deploys td.when { | @@ -664,20 +664,60 @@ table.deploys td.when { | ||
664 | margin: 0; | 664 | margin: 0; |
665 | } | 665 | } |
666 | 666 | ||
667 | +table.backtrace { | ||
668 | + padding: 8px 0; | ||
669 | + background-color: #222; | ||
670 | +} | ||
671 | + | ||
672 | +table.backtrace td { | ||
673 | + width: 100%; | ||
674 | + padding: 0; | ||
675 | + margin: 0; | ||
676 | + color: #C7C7C7; | ||
677 | + background-color: #222; | ||
678 | +} | ||
679 | + | ||
680 | +table.backtrace td, table.backtrace th { | ||
681 | + border-top: none; | ||
682 | +} | ||
683 | + | ||
684 | +/* remove alternating color rules */ | ||
685 | +table.backtrace tr:nth-child(2n+1) td { background-color: #222; } | ||
686 | +table.backtrace tr:first-child td { border-top: 0; } | ||
687 | + | ||
688 | +table.backtrace th.line-numbers { | ||
689 | + border-bottom: 1px solid #F0F0F0; | ||
690 | + font-size: 13px; | ||
691 | + text-align: right; | ||
692 | + vertical-align: top; | ||
693 | + padding: 1px 6px 1px 7px; | ||
694 | +} | ||
695 | + | ||
667 | table.backtrace td.line { | 696 | table.backtrace td.line { |
668 | - color: #777; /* 47% */ | ||
669 | - background-color: #222 !important; | ||
670 | - border: none; | ||
671 | - padding: 1px 8px; | 697 | + font-size: 13px; |
698 | + padding: 2px 8px; | ||
699 | + vertical-align: top; | ||
700 | + white-space: nowrap; | ||
672 | } | 701 | } |
702 | + | ||
673 | table.backtrace td.line .file { | 703 | table.backtrace td.line .file { |
674 | - color:#d2d2d2; /* 82% */ | 704 | + color:#ededed; |
705 | + font-weight:bold; | ||
675 | } | 706 | } |
676 | table.backtrace td.line .method { | 707 | table.backtrace td.line .method { |
677 | - color:#ececec; /* 93% */ | 708 | + color:#aaa; |
678 | font-weight:bold; | 709 | font-weight:bold; |
679 | } | 710 | } |
680 | 711 | ||
712 | +table.backtrace td.line.in-app { | ||
713 | + color: #2adb2e; | ||
714 | + background-color: #2f2f2f; | ||
715 | +} | ||
716 | + | ||
717 | +table.backtrace tr.in-app td.line { color:#156E16; /* 43% */} | ||
718 | +table.backtrace tr.in-app td.line .file { color:#2adb2e; /* 76% */} | ||
719 | +table.backtrace tr.in-app td.line .method { color:#25C227; /* 86% */} | ||
720 | + | ||
681 | /* Extra empty rows at top and bottom of table */ | 721 | /* Extra empty rows at top and bottom of table */ |
682 | table.backtrace tr.padding th, table.backtrace tr.padding td { | 722 | table.backtrace tr.padding th, table.backtrace tr.padding td { |
683 | height: 10px; | 723 | height: 10px; |
@@ -686,6 +726,7 @@ table.backtrace tr.padding th, table.backtrace tr.padding td { | @@ -686,6 +726,7 @@ table.backtrace tr.padding th, table.backtrace tr.padding td { | ||
686 | } | 726 | } |
687 | 727 | ||
688 | 728 | ||
729 | + | ||
689 | span.click_span { | 730 | span.click_span { |
690 | font-size: 0.7em; | 731 | font-size: 0.7em; |
691 | } | 732 | } |
@@ -740,7 +781,3 @@ table.errs tr td.message .inline_comment em.commenter { | @@ -740,7 +781,3 @@ table.errs tr td.message .inline_comment em.commenter { | ||
740 | color: #888888; | 781 | color: #888888; |
741 | } | 782 | } |
742 | 783 | ||
743 | -table.backtrace tr.in-app td.line { color:#156E16; /* 43% */} | ||
744 | -table.backtrace tr.in-app td.line .file { color:#25C227; /* 76% */} | ||
745 | -table.backtrace tr.in-app td.line .method { color:#2adb2e; /* 86% */} | ||
746 | - |