Skip to content

Commit

Permalink
改用 ExceptionTrack 代替之前的 ExceptionLog 的代码 (#864)
Browse files Browse the repository at this point in the history
  • Loading branch information
huacnlee authored Feb 17, 2017
1 parent d55e095 commit 75656eb
Show file tree
Hide file tree
Showing 22 changed files with 47 additions and 145 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ gem 'puma'
gem 'rack-cors', require: 'rack/cors'
gem 'rack-utf8_sanitizer'

gem 'exception_notification'
gem 'exception-track'
gem 'status-page'

gem 'bundler-audit', require: false
Expand Down
6 changes: 5 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ GEM
faraday
multi_json
erubis (2.7.0)
exception-track (0.1.2)
exception_notification (~> 4.1)
rails (>= 4.2.0, < 5.1)
will_paginate (~> 3)
exception_notification (4.2.1)
actionmailer (>= 4.0, < 6)
activesupport (>= 4.0, < 6)
Expand Down Expand Up @@ -424,7 +428,7 @@ DEPENDENCIES
dropzonejs-rails
elasticsearch-model
elasticsearch-rails
exception_notification
exception-track
factory_girl_rails
font-awesome-rails
hiredis
Expand Down
21 changes: 0 additions & 21 deletions app/controllers/admin/exception_logs_controller.rb

This file was deleted.

4 changes: 2 additions & 2 deletions app/controllers/auth/sso_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def login

puts message

ExceptionLog.create(title: "SSO Failed to create or lookup user:", body: message)
ExceptionTrack::Log.create(title: "SSO Failed to create or lookup user:", body: message)
render plain: I18n.t("sso.unknown_error"), status: 500
return
end
Expand Down Expand Up @@ -75,4 +75,4 @@ def provider
redirect_to sso.to_url(sso.return_sso_url)
end
end
end
end
2 changes: 0 additions & 2 deletions app/models/exception_log.rb

This file was deleted.

3 changes: 0 additions & 3 deletions app/views/admin/exception_logs/_base.html.erb

This file was deleted.

2 changes: 0 additions & 2 deletions app/views/admin/exception_logs/destroy.js.erb

This file was deleted.

28 changes: 0 additions & 28 deletions app/views/admin/exception_logs/index.html.erb

This file was deleted.

8 changes: 0 additions & 8 deletions app/views/admin/exception_logs/show.html.erb

This file was deleted.

1 change: 1 addition & 0 deletions app/views/admin/home/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<a href="/admin/applications" class="btn btn-default"><i class="fa fa-cubes"></i> 三方应用</a>
<a href="/sidekiq" class="btn btn-default" target="_blank"><i class="fa fa-tasks"></i> 异步任务...</a>
<a href="/pghero" class="btn btn-default" target="_blank"><i class="fa fa-database"></i> 数据库状态...</a>
<a href="/exception-track" class="btn btn-default" target="_blank"><i class="fa fa-warning"></i> <%= t("admin.menu.exception_logs") %>...</a>
</div>
</div>

Expand Down
1 change: 0 additions & 1 deletion app/views/layouts/admin.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
li << link_to(t("admin.menu.site_nodes"),admin_site_nodes_path ) if Setting.has_module?(:site)
li << link_to(t("admin.menu.sites"),admin_sites_path ) if Setting.has_module?(:site)
li << link_to(t("admin.menu.locations"),admin_locations_path )
li << link_to(t("admin.menu.exception_logs"),admin_exception_logs_path )
end %>

<%= render "shared/usernav" %>
Expand Down
16 changes: 16 additions & 0 deletions config/initializers/exception-track.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
require 'exception_notification/sidekiq'

ExceptionTrack.configure do
# self.environments = %i(production)
end

ExceptionNotification.configure do |config|
config.ignored_exceptions += %w(
ActionView::TemplateError
ActionController::InvalidAuthenticityToken
ActionController::BadRequest
ActionView::MissingTemplate
ActionController::UrlGenerationError
ActionController::UnknownFormat
)
end
13 changes: 0 additions & 13 deletions config/initializers/exception_notification.rb

This file was deleted.

2 changes: 1 addition & 1 deletion config/locales/admin.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
users:
trust_user_can_modify_wiki: "Allow user to modify Wiki"
topic_list: "Topic List"
check_photo: "View Photo"
check_photo: "View Photo"
2 changes: 1 addition & 1 deletion config/locales/admin.zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@
trust_user_can_modify_wiki: "信任用户将可以修改 Wiki"
hr_user_can_create_topic: "招聘人员角色可以忽略新手限制直接发帖"
topic_list: "话题列表"
check_photo: "瀏覽圖片"
check_photo: "瀏覽圖片"
3 changes: 0 additions & 3 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ en:
url: "URL"
desc: "Description"
site_node_id: "Category"
exception_log:
title: Abstract
body: Details
errors:
models:
user: "User"
Expand Down
3 changes: 0 additions & 3 deletions config/locales/zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,6 @@
url: 地址
desc: 简单介绍
site_node_id: 分类
exception_log:
title: 摘要
body: 详细内容
device:
platform: 类型
token: Token
Expand Down
3 changes: 0 additions & 3 deletions config/locales/zh-TW.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@
url: 地址
desc: 簡單介紹
site_node_id: 分類
exception_log:
title: 摘要
body: 詳細內容
errors:
models:
user: 用戶
Expand Down
6 changes: 1 addition & 5 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,6 @@
end
end
resources :locations
resources :exception_logs do
collection do
post :clean
end
end
resources :applications
resources :stats
end
Expand Down Expand Up @@ -199,6 +194,7 @@
authenticate :user, ->(u) { u.admin? } do
mount Sidekiq::Web, at: '/sidekiq'
mount PgHero::Engine, at: "pghero"
mount ExceptionTrack::Engine, at: "/exception-track"
end

mount JasmineRails::Engine, at: '/specs' if defined?(JasmineRails)
Expand Down
13 changes: 13 additions & 0 deletions db/migrate/20170217050010_create_exception_track_logs.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# This migration comes from exception_track (originally 20170217023900)
class CreateExceptionTrackLogs < ActiveRecord::Migration[5.0]
def change
create_table :exception_tracks do |t|
t.string :title
t.text :body

t.timestamps
end

drop_table :exception_logs
end
end
12 changes: 6 additions & 6 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20170204090209) do
ActiveRecord::Schema.define(version: 20170217050010) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -61,11 +61,11 @@
t.index ["user_id"], name: "index_devices_on_user_id", using: :btree
end

create_table "exception_logs", force: :cascade do |t|
t.string "title", null: false
t.text "body", null: false
t.datetime "created_at"
t.datetime "updated_at"
create_table "exception_tracks", force: :cascade do |t|
t.string "title"
t.text "body"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

create_table "locations", force: :cascade do |t|
Expand Down
41 changes: 0 additions & 41 deletions lib/exception_notifier/database_notifier.rb

This file was deleted.

0 comments on commit 75656eb

Please sign in to comment.