ndr_error 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/ndr_error/bootstrap/_bootstrap-sprockets.scss +13 -0
- data/app/assets/stylesheets/ndr_error/bootstrap/_glyphicons.scss +0 -4
- data/app/assets/stylesheets/ndr_error/bootstrap/_variables.scss +0 -4
- data/app/assets/stylesheets/ndr_error/bootstrap/bootstrap.scss +3 -0
- data/app/controllers/ndr_error/errors_controller.rb +6 -10
- data/app/helpers/ndr_error/errors_helper.rb +3 -3
- data/app/models/ndr_error/fingerprint.rb +5 -4
- data/app/models/ndr_error/log.rb +6 -15
- data/app/views/layouts/ndr_error/ndr_error.html.erb +1 -1
- data/app/views/ndr_error/errors/show.html.erb +2 -2
- data/db/migrate/20150918162403_create_error_fingerprints.rb +1 -1
- data/db/migrate/20150918162612_create_error_logs.rb +1 -1
- data/lib/ndr_error/finder.rb +2 -2
- data/lib/ndr_error/version.rb +1 -1
- data/lib/ndr_error.rb +8 -0
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18c4994bc7ec7b91eb2c3a2d60a6db73cbc054d8
|
4
|
+
data.tar.gz: a9b52f7802cd09c0468154a3598c904b7a12cf82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21698703d3cd2e149b9826420b074f1bfce832da87d22519fca7f801eafebd5a1f5cdaa9819b96683c54bbcf62cb716c7b9dc5ce751cfd4f4545ebb14edeebc2
|
7
|
+
data.tar.gz: 8e9c013e9fb0e5e17bc96011281e0358937820c5d3b72c901bd2a09592a75f16d4becc27288baa93efebe1f6aa6a084bdf2950a60488f8e3ad6f0b1074682608
|
@@ -0,0 +1,13 @@
|
|
1
|
+
@function twbs-font-path($path) {
|
2
|
+
@return font-path($path);
|
3
|
+
}
|
4
|
+
|
5
|
+
@function twbs-image-path($path) {
|
6
|
+
@return image-path($path);
|
7
|
+
}
|
8
|
+
|
9
|
+
// Use the above functions where required:
|
10
|
+
$bootstrap-sass-asset-helper: true;
|
11
|
+
|
12
|
+
// Look for fonts in the ndr_error namespace:
|
13
|
+
$icon-font-path: 'ndr_error/bootstrap/';
|
@@ -1,7 +1,3 @@
|
|
1
|
-
//= depend_on "bootstrap/glyphicons-halflings-regular.eot"
|
2
|
-
//= depend_on "bootstrap/glyphicons-halflings-regular.svg"
|
3
|
-
//= depend_on "bootstrap/glyphicons-halflings-regular.ttf"
|
4
|
-
//= depend_on "bootstrap/glyphicons-halflings-regular.woff"
|
5
1
|
//
|
6
2
|
// Glyphicons for Bootstrap
|
7
3
|
//
|
@@ -1,7 +1,3 @@
|
|
1
|
-
// a flag to toggle asset pipeline / compass integration
|
2
|
-
// defaults to true if twbs-font-path function is present (no function => twbs-font-path('') parsed as string == right side)
|
3
|
-
// in Sass 3.3 this can be improved with: function-exists(twbs-font-path)
|
4
|
-
$bootstrap-sass-asset-helper: (twbs-font-path("") != unquote('twbs-font-path("")')) !default;
|
5
1
|
//
|
6
2
|
// Variables
|
7
3
|
// --------------------------------------------------
|
@@ -14,17 +14,13 @@ module NdrError
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def show
|
17
|
-
@
|
18
|
-
|
19
|
-
@fingerprint.error_logs.find(id)
|
20
|
-
else
|
21
|
-
@fingerprint.error_logs.first
|
22
|
-
end
|
17
|
+
logs = @fingerprint.error_logs.not_deleted
|
18
|
+
@error = (id = params[:log_id]) ? logs.find_by(error_logid: id) : logs.first
|
23
19
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
20
|
+
if @error.nil?
|
21
|
+
flash[:error] = 'No matching Logs exist for that Fingerprint!'
|
22
|
+
redirect_to error_fingerprints_url(q: @fingerprint.to_param)
|
23
|
+
end
|
28
24
|
end
|
29
25
|
|
30
26
|
def edit
|
@@ -3,7 +3,7 @@ module NdrError
|
|
3
3
|
module ErrorsHelper
|
4
4
|
def search_matches(string, keywords)
|
5
5
|
return string if keywords.blank?
|
6
|
-
highlight(string, keywords, highlighter: '<strong class="text-danger">\1</strong>')
|
6
|
+
highlight(string.to_s, keywords, highlighter: '<strong class="text-danger">\1</strong>')
|
7
7
|
end
|
8
8
|
|
9
9
|
def highlighted_trace_for(error)
|
@@ -81,7 +81,7 @@ module NdrError
|
|
81
81
|
def previous_button_for(error)
|
82
82
|
css = 'btn btn-default'
|
83
83
|
css << ' disabled' if error.nil?
|
84
|
-
text = glyphicon_tag('chevron-left') + h('
|
84
|
+
text = glyphicon_tag('chevron-left') + h('Previous Occurrence')
|
85
85
|
path = error.nil? ? '#' : error_fingerprint_path(error.error_fingerprint, log_id: error)
|
86
86
|
|
87
87
|
link_to(text, path, class: css)
|
@@ -90,7 +90,7 @@ module NdrError
|
|
90
90
|
def next_button_for(error)
|
91
91
|
css = 'btn btn-default'
|
92
92
|
css << ' disabled' if error.nil?
|
93
|
-
text = h('
|
93
|
+
text = h('Next Occurrence') + glyphicon_tag('chevron-right')
|
94
94
|
path = error.nil? ? '#' : error_fingerprint_path(error.error_fingerprint, log_id: error)
|
95
95
|
|
96
96
|
link_to(text, path, class: css)
|
@@ -7,15 +7,16 @@ module NdrError
|
|
7
7
|
self.primary_key = 'error_fingerprintid'
|
8
8
|
|
9
9
|
has_many :error_logs,
|
10
|
+
-> { latest_first },
|
10
11
|
autosave: true,
|
11
12
|
class_name: 'NdrError::Log',
|
12
13
|
foreign_key: 'error_fingerprintid'
|
13
14
|
|
14
15
|
validate :ensure_ticket_url_matched_a_supplied_format
|
15
16
|
|
16
|
-
|
17
|
+
scope :latest_first, lambda {
|
17
18
|
order("#{table_name}.updated_at DESC, #{table_name}.error_fingerprintid DESC")
|
18
|
-
|
19
|
+
}
|
19
20
|
|
20
21
|
def self.filter_by_keywords(keywords)
|
21
22
|
md5_match = keywords.map do |part|
|
@@ -73,7 +74,7 @@ module NdrError
|
|
73
74
|
# have been loaded by rails internally
|
74
75
|
# and won't have default scoping applied.
|
75
76
|
def first_occurrence
|
76
|
-
|
77
|
+
error_logs.last
|
77
78
|
end
|
78
79
|
|
79
80
|
# Returns the record corresponding to the
|
@@ -82,7 +83,7 @@ module NdrError
|
|
82
83
|
# have been loaded by rails internally
|
83
84
|
# and won't have default scoping applied.
|
84
85
|
def latest_occurrence
|
85
|
-
|
86
|
+
error_logs.first
|
86
87
|
end
|
87
88
|
end
|
88
89
|
end
|
data/app/models/ndr_error/log.rb
CHANGED
@@ -19,10 +19,10 @@ module NdrError
|
|
19
19
|
class_name: 'NdrError::Fingerprint',
|
20
20
|
foreign_key: 'error_fingerprintid'
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
scope :deleted, -> { where("status like 'deleted%'") }
|
23
|
+
scope :not_deleted, -> { where("(status is null) or (status not like 'deleted%')") }
|
24
|
+
|
25
|
+
scope :latest_first, -> { order('created_at DESC, error_logid DESC') }
|
26
26
|
|
27
27
|
validates :error_fingerprintid, presence: true
|
28
28
|
validates :description, presence: true
|
@@ -50,21 +50,12 @@ module NdrError
|
|
50
50
|
where(name_match)
|
51
51
|
end
|
52
52
|
|
53
|
-
# Make explicit when circumventing the default scope
|
54
|
-
def self.including_deleted_logs(&block)
|
55
|
-
unscoped(&block)
|
56
|
-
end
|
57
|
-
|
58
53
|
# Deletes all those errors that have been flagged for
|
59
54
|
# deletion and whose soft-delete grace period has ended.
|
60
55
|
#
|
61
56
|
# Returns true if any records were deleted.
|
62
57
|
def self.perform_cleanup!
|
63
|
-
|
64
|
-
where("status like 'deleted%'")
|
65
|
-
end
|
66
|
-
|
67
|
-
destroys = records.map do |record|
|
58
|
+
destroys = deleted.map do |record|
|
68
59
|
stamp_string = record.status.sub(/^[^\d]+/, '')
|
69
60
|
record.destroy if Time.zone.parse(stamp_string) < NdrError.log_grace_period.ago
|
70
61
|
end
|
@@ -75,7 +66,7 @@ module NdrError
|
|
75
66
|
# Finds gets all errors that share an MD5 hash
|
76
67
|
# (including _error_).
|
77
68
|
def self.similar_to(error)
|
78
|
-
error.error_fingerprint.error_logs
|
69
|
+
error.error_fingerprint.error_logs.not_deleted
|
79
70
|
end
|
80
71
|
|
81
72
|
# Gets similar errors.
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<div
|
1
|
+
<div>
|
2
2
|
<div class="pull-right">
|
3
3
|
<div class="btn-group">
|
4
4
|
<%= ticket_link_for(@fingerprint) if @fingerprint.ticket_url.present? %>
|
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
<div class="btn-group">
|
16
16
|
<a class="btn btn-default dropdown-toggle" data-toggle="dropdown" href="#">
|
17
|
-
<%= pluralize(@error.similar_errors.length, '
|
17
|
+
<%= pluralize(@error.similar_errors.length, 'Similar Error') %> Stored
|
18
18
|
<span class="caret"></span>
|
19
19
|
</a>
|
20
20
|
<ul class="dropdown-menu">
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Adds complete ERROR_FINGERPRINT table to schema
|
2
|
-
class CreateErrorFingerprints <
|
2
|
+
class CreateErrorFingerprints < NdrError.migration_class
|
3
3
|
def change
|
4
4
|
create_table :error_fingerprints, id: false do |t|
|
5
5
|
t.string :error_fingerprintid, primary_key: true
|
data/lib/ndr_error/finder.rb
CHANGED
@@ -2,14 +2,14 @@ module NdrError
|
|
2
2
|
# Module to help with searching through fingerprints / logs.
|
3
3
|
module Finder
|
4
4
|
def search(keywords)
|
5
|
-
scope = Fingerprint.
|
5
|
+
scope = Fingerprint.latest_first
|
6
6
|
return scope unless keywords && keywords.any?
|
7
7
|
|
8
8
|
# Fetch the collection of fingerprint matches:
|
9
9
|
records = scope.filter_by_keywords(keywords).to_a
|
10
10
|
|
11
11
|
# Add to that fingerprints with log records that matched the search:
|
12
|
-
log_print_ids = Log.filter_by_keywords(keywords).pluck(:error_fingerprintid)
|
12
|
+
log_print_ids = Log.not_deleted.filter_by_keywords(keywords).pluck(:error_fingerprintid)
|
13
13
|
records.concat scope.find(log_print_ids)
|
14
14
|
|
15
15
|
order(records)
|
data/lib/ndr_error/version.rb
CHANGED
data/lib/ndr_error.rb
CHANGED
@@ -89,4 +89,12 @@ module NdrError
|
|
89
89
|
def self.table_name_prefix
|
90
90
|
'error_'
|
91
91
|
end
|
92
|
+
|
93
|
+
# Rails 5 uses versioned migrations (required as of 5.1). This helper method returns an
|
94
|
+
# appropriate migration superclass for the Rails version of the host application. Note that the
|
95
|
+
# 4.2 compatability layer is targetted since all the bundled migrations were written prior to
|
96
|
+
# Rails 5.
|
97
|
+
def self.migration_class
|
98
|
+
Rails::VERSION::MAJOR < 5 ? ActiveRecord::Migration : ActiveRecord::Migration[4.2]
|
99
|
+
end
|
92
100
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ndr_error
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- NCRS Development Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '4.1'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '5.
|
22
|
+
version: '5.2'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '4.1'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '5.
|
32
|
+
version: '5.2'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: will_paginate
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -189,6 +189,7 @@ files:
|
|
189
189
|
- app/assets/javascripts/ndr_error/ndr_error.js
|
190
190
|
- app/assets/stylesheets/ndr_error/bootstrap/_alerts.scss
|
191
191
|
- app/assets/stylesheets/ndr_error/bootstrap/_badges.scss
|
192
|
+
- app/assets/stylesheets/ndr_error/bootstrap/_bootstrap-sprockets.scss
|
192
193
|
- app/assets/stylesheets/ndr_error/bootstrap/_breadcrumbs.scss
|
193
194
|
- app/assets/stylesheets/ndr_error/bootstrap/_button-groups.scss
|
194
195
|
- app/assets/stylesheets/ndr_error/bootstrap/_buttons.scss
|
@@ -301,7 +302,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
301
302
|
version: '0'
|
302
303
|
requirements: []
|
303
304
|
rubyforge_project:
|
304
|
-
rubygems_version: 2.
|
305
|
+
rubygems_version: 2.6.14
|
305
306
|
signing_key:
|
306
307
|
specification_version: 4
|
307
308
|
summary: Rails exception logging
|