snitch_reporting 1.0.3 → 1.0.4
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/snitch_reporting/components.scss +7 -0
- data/app/controllers/snitch_reporting/snitch_reports_controller.rb +1 -1
- data/app/models/snitch_reporting/snitch_occurrence.rb +7 -1
- data/app/models/snitch_reporting/snitch_report.rb +19 -1
- data/app/views/snitch_reporting/snitch_reports/index.html.erb +9 -8
- data/app/views/snitch_reporting/snitch_reports/show.html.erb +8 -4
- data/config/initializers/snitch_reporting.rb +5 -0
- data/lib/snitch_reporting/rack.rb +6 -2
- data/lib/snitch_reporting/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13ca38a1a092ebfb990a2dcd85bf75973cf69fee709e2111ad1eb546626d83b6
|
4
|
+
data.tar.gz: cda6e441fffb8a0c0691456b3327325ca0d36dd2816f5552cc56aec8bf90256e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ece5f42bcd69b1813f8492a5d98f24df398e044d0b2dec2b23667096d93cdc6d742916f99e651659eb0adb559b985b35fb42df6c5e26b226ec4039a3f012c7cb
|
7
|
+
data.tar.gz: 77f89fafa5dd29bb2fdbc1e506ed9e03cf3cbb4a39f98fbd2de6b16e84d848db9c2b4158df6dff1074cad8c49856ad237b84029d3c367258686f90171977993e
|
@@ -112,7 +112,7 @@ class ::SnitchReporting::SnitchReportsController < ApplicationController
|
|
112
112
|
status: {
|
113
113
|
default: :unresolved,
|
114
114
|
values: [:all, :resolved, :unresolved]
|
115
|
-
}
|
115
|
+
}
|
116
116
|
# assignee: {
|
117
117
|
# default: :any,
|
118
118
|
# values: [:any, :me, :not_me, :not_assigned]
|
@@ -118,6 +118,12 @@ class SnitchReporting::SnitchOccurrence < ApplicationRecord
|
|
118
118
|
# temp_details
|
119
119
|
# end
|
120
120
|
|
121
|
+
def notify_occurrence
|
122
|
+
return unless notify?
|
123
|
+
|
124
|
+
SnitchReporting.notify(self)
|
125
|
+
end
|
126
|
+
|
121
127
|
def notify?
|
122
128
|
@should_notify ||= always_notify || report.resolved? || report.occurrence_count == 1
|
123
129
|
end
|
@@ -125,7 +131,7 @@ class SnitchReporting::SnitchOccurrence < ApplicationRecord
|
|
125
131
|
private
|
126
132
|
|
127
133
|
def mark_occurrence
|
128
|
-
|
134
|
+
notify_occurrence
|
129
135
|
report_updates = { last_occurrence_at: Time.current, resolved_at: nil }
|
130
136
|
report_updates[:first_occurrence_at] = Time.current if report.first_occurrence_at.nil?
|
131
137
|
report_updates[:occurrence_count] = report.occurrence_count.to_i + 1
|
@@ -24,6 +24,8 @@ class SnitchReporting::SnitchReport < ApplicationRecord
|
|
24
24
|
# belongs_to :resolved_by
|
25
25
|
# belongs_to :ignored_by
|
26
26
|
|
27
|
+
serialize :tags, ::SnitchReporting::Service::JSONWrapper
|
28
|
+
|
27
29
|
scope :resolved, -> { where.not(resolved_at: nil) }
|
28
30
|
scope :unresolved, -> { where(resolved_at: nil) }
|
29
31
|
scope :ignored, -> { where.not(ignored_at: nil) }
|
@@ -199,7 +201,9 @@ class SnitchReporting::SnitchReport < ApplicationRecord
|
|
199
201
|
# Not using find or create because the slug might be `nil`- in these
|
200
202
|
# cases, we want to create a new report so that we don't falsely group
|
201
203
|
# unrelated errors together.
|
202
|
-
report
|
204
|
+
report ||= create(report_identifiable_data)
|
205
|
+
report.add_tags(arg_hash.delete(:tags))
|
206
|
+
report
|
203
207
|
end
|
204
208
|
|
205
209
|
def gather_report_data(env, exceptions, arg_hash, arg_values)
|
@@ -262,6 +266,20 @@ class SnitchReporting::SnitchReport < ApplicationRecord
|
|
262
266
|
trackers.tracker_for_date(date)
|
263
267
|
end
|
264
268
|
|
269
|
+
def tags
|
270
|
+
super || []
|
271
|
+
end
|
272
|
+
|
273
|
+
def tags=(new_tags)
|
274
|
+
super((new_tags.try(:to_a) || [new_tags]).compact.flatten)
|
275
|
+
end
|
276
|
+
|
277
|
+
def add_tags(new_tags)
|
278
|
+
return if new_tags.blank?
|
279
|
+
|
280
|
+
update(tags: tags + [new_tags])
|
281
|
+
end
|
282
|
+
|
265
283
|
def resolved?; resolved_at?; end
|
266
284
|
def ignored?; ignored_at?; end
|
267
285
|
|
@@ -1,13 +1,9 @@
|
|
1
1
|
<div class="snitch-reporting">
|
2
|
-
<!--
|
2
|
+
<!--
|
3
3
|
<div class="nav-tab">
|
4
4
|
<input type="search" name="search" value="<%= params[:search] %>" placeholder="Search">
|
5
5
|
</div>
|
6
|
-
|
7
|
-
<a href="<%# %>">Assignee</a>
|
8
|
-
<a href="<%# %>">Occurred</a>
|
9
|
-
<a href="<%# %>">Ignored</a>
|
10
|
-
</div> -->
|
6
|
+
-->
|
11
7
|
<div class="filters">
|
12
8
|
<% @filter_sets.each do |filter_name, filter_set| %>
|
13
9
|
<div class="snitch-table filter-table">
|
@@ -44,7 +40,7 @@
|
|
44
40
|
<div class="snitch-th">Error</div>
|
45
41
|
<div class="snitch-th" style="width: 150px;">Last</div>
|
46
42
|
<div class="snitch-th" style="width: 1px;">Times</div>
|
47
|
-
<div class="snitch-th" style="width: 1px;">
|
43
|
+
<div class="snitch-th" style="width: 1px;">Tags</div>
|
48
44
|
<div class="snitch-th" style="width: 1px;">Status</div>
|
49
45
|
</div>
|
50
46
|
</div>
|
@@ -62,7 +58,12 @@
|
|
62
58
|
<% end %>
|
63
59
|
<div class="snitch-td"><%= report.last_occurrence_at %></div>
|
64
60
|
<div class="snitch-td"><%= number_with_delimiter(report.occurrence_count) %></div>
|
65
|
-
<div class="snitch-td"
|
61
|
+
<div class="snitch-td">
|
62
|
+
<% report.tags.each_with_index do |tag, idx| %>
|
63
|
+
<span class="snitch-tag"><%= tag %></span><%= ', ' if idx < report.tags.length - 1 %>
|
64
|
+
<% end %>
|
65
|
+
</div>
|
66
|
+
<!-- <div class="snitch-td"><%= report.assigned_to.try(:name).presence || "-" %></div> -->
|
66
67
|
<div class="snitch-td">
|
67
68
|
<%= content_tag :input, "", type: :checkbox, name: :resolved, class: "snitch-resolution-switch", checked: report.resolved?, data: { mark_resolution_url: snitch_report_url(report) } %>
|
68
69
|
</div>
|
@@ -91,10 +91,14 @@
|
|
91
91
|
</todo>
|
92
92
|
</div>
|
93
93
|
</div> -->
|
94
|
-
|
95
|
-
<div class="snitch-td">Tags
|
96
|
-
<div class="snitch-td"
|
97
|
-
|
94
|
+
<div class="snitch-tr">
|
95
|
+
<div class="snitch-td">Tags</div>
|
96
|
+
<div class="snitch-td">
|
97
|
+
<% @report.tags.each_with_index do |tag, idx| %>
|
98
|
+
<span class="snitch-tag"><%= tag %></span><%= ', ' if idx < @report.tags.length - 1 %>
|
99
|
+
<% end %>
|
100
|
+
</div>
|
101
|
+
</div>
|
98
102
|
</div>
|
99
103
|
</div>
|
100
104
|
|
@@ -4,7 +4,12 @@ class SnitchReporting::Rack
|
|
4
4
|
|
5
5
|
def initialize(app, notify_callback=nil)
|
6
6
|
@app = app
|
7
|
-
|
7
|
+
|
8
|
+
return unless notify_callback.present?
|
9
|
+
|
10
|
+
::SnitchReporting.define_singleton_method :notify do |occurrence|
|
11
|
+
notify_callback.call(occurrence)
|
12
|
+
end
|
8
13
|
end
|
9
14
|
|
10
15
|
def call(env)
|
@@ -20,7 +25,6 @@ class SnitchReporting::Rack
|
|
20
25
|
response
|
21
26
|
rescue Exception => exception
|
22
27
|
occurrence = ::SnitchReporting::SnitchReport.fatal(exception, env: env)
|
23
|
-
notify_callback.call(occurrence) if occurrence.notify?
|
24
28
|
|
25
29
|
raise exception unless exception.is_a?(SnitchException)
|
26
30
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snitch_reporting
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rocco Nicholls
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -102,6 +102,7 @@ files:
|
|
102
102
|
- app/views/snitch_reporting/snitch_reports/edit.html.erb
|
103
103
|
- app/views/snitch_reporting/snitch_reports/index.html.erb
|
104
104
|
- app/views/snitch_reporting/snitch_reports/show.html.erb
|
105
|
+
- config/initializers/snitch_reporting.rb
|
105
106
|
- config/routes.rb
|
106
107
|
- lib/generators/snitch_reporting/install/install_generator.rb
|
107
108
|
- lib/generators/snitch_reporting/install/templates/install_snitch_reporting.rb
|