Commit 32e9bbfc47a9b5101794683a2dc7e387e15057df

Authored by Nathan Broadbent
1 parent 1ec24d91
Exists in master and in 1 other branch production

Added asset_host to generate JavaScript links in backtraces

app/helpers/backtrace_line_helper.rb
@@ -7,13 +7,24 @@ module BacktraceLineHelper @@ -7,13 +7,24 @@ module BacktraceLineHelper
7 private 7 private
8 def link_to_in_app_source_file(line, text) 8 def link_to_in_app_source_file(line, text)
9 return unless line.in_app? 9 return unless line.in_app?
10 - link_to_repo_source_file(line, text) || link_to_issue_tracker_file(line, text) 10 + if line.file_name =~ /\.js$/
  11 + link_to_hosted_javascript(line, text)
  12 + else
  13 + link_to_repo_source_file(line, text) ||
  14 + link_to_issue_tracker_file(line, text)
  15 + end
11 end 16 end
12 17
13 def link_to_repo_source_file(line, text) 18 def link_to_repo_source_file(line, text)
14 link_to_github(line, text) || link_to_bitbucket(line, text) 19 link_to_github(line, text) || link_to_bitbucket(line, text)
15 end 20 end
16 21
  22 + def link_to_hosted_javascript(line, text)
  23 + if line.app.asset_host?
  24 + link_to(text, "#{line.app.asset_host}/#{line.file_relative}", :target => '_blank')
  25 + end
  26 + end
  27 +
17 def link_to_external_source_file(text) 28 def link_to_external_source_file(text)
18 text 29 text
19 end 30 end
app/models/app.rb
@@ -7,6 +7,7 @@ class App @@ -7,6 +7,7 @@ class App
7 field :api_key 7 field :api_key
8 field :github_repo 8 field :github_repo
9 field :bitbucket_repo 9 field :bitbucket_repo
  10 + field :asset_host
10 field :repository_branch 11 field :repository_branch
11 field :resolve_errs_on_deploy, :type => Boolean, :default => false 12 field :resolve_errs_on_deploy, :type => Boolean, :default => false
12 field :notify_all_users, :type => Boolean, :default => false 13 field :notify_all_users, :type => Boolean, :default => false
app/views/apps/_fields.html.haml
@@ -13,6 +13,10 @@ @@ -13,6 +13,10 @@
13 %div 13 %div
14 = f.label :bitbucket_repo 14 = f.label :bitbucket_repo
15 = f.text_field :bitbucket_repo, :placeholder => "errbit/errbit from https://bitbucket.org/errbit/errbit" 15 = f.text_field :bitbucket_repo, :placeholder => "errbit/errbit from https://bitbucket.org/errbit/errbit"
  16 +%div
  17 + = f.label :asset_host
  18 + %em Used to generate links for JavaScript errors
  19 + = f.text_field :asset_host, :placeholder => "e.g. https://assets.example.com"
16 20
17 %fieldset 21 %fieldset
18 %legend Notifications 22 %legend Notifications