snitch_reporting 0.1.0 → 1.0.0
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/README.md +23 -3
- data/app/assets/javascripts/snitch_reporting/snitch_report.js +60 -0
- data/app/assets/stylesheets/snitch_reporting/_variables.scss +5 -0
- data/app/assets/stylesheets/snitch_reporting/components.scss +120 -0
- data/app/assets/stylesheets/snitch_reporting/containers.scss +6 -0
- data/app/assets/stylesheets/snitch_reporting/default.scss +18 -0
- data/app/assets/stylesheets/snitch_reporting/forms.scss +36 -0
- data/app/assets/stylesheets/snitch_reporting/navigation.scss +37 -0
- data/app/assets/stylesheets/snitch_reporting/snitch_report.scss +1 -0
- data/app/assets/stylesheets/snitch_reporting/tables.scss +127 -0
- data/app/controllers/snitch_reporting/application_controller.rb +4 -0
- data/app/controllers/snitch_reporting/snitch_reports_controller.rb +167 -0
- data/app/helpers/snitch_reporting/params_helper.rb +38 -0
- data/app/helpers/snitch_reporting/snitch_report_helper.rb +2 -0
- data/app/models/snitch_reporting/service/json_wrapper.rb +5 -0
- data/app/models/snitch_reporting/snitch_comment.rb +7 -0
- data/app/models/snitch_reporting/snitch_history.rb +7 -0
- data/app/models/snitch_reporting/snitch_occurrence.rb +183 -0
- data/app/models/snitch_reporting/snitch_report.rb +301 -0
- data/app/models/snitch_reporting/snitch_tracker.rb +17 -0
- data/app/views/snitch_reporting/snitch_reports/_filters.html.erb +16 -0
- data/app/views/snitch_reporting/snitch_reports/_navigation.html.erb +0 -0
- data/app/views/snitch_reporting/snitch_reports/edit.html.erb +19 -0
- data/app/views/snitch_reporting/snitch_reports/index.html.erb +75 -0
- data/app/views/snitch_reporting/snitch_reports/show.html.erb +189 -0
- data/config/routes.rb +4 -1
- data/lib/generators/snitch_reporting/install/install_generator.rb +24 -0
- data/lib/generators/snitch_reporting/install/templates/install_snitch_reporting.rb +62 -0
- data/lib/snitch_reporting/engine.rb +3 -0
- data/lib/snitch_reporting/rack.rb +29 -0
- data/lib/snitch_reporting/version.rb +1 -1
- data/lib/snitch_reporting.rb +3 -1
- metadata +58 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39e98ad05cdaa6ead3d81003f273cfdea222889ee63be8ef6503c31b29cfe055
|
4
|
+
data.tar.gz: 331b7c7e03b98ee862a21e41f33c05c97b25a12a45676ebb3a560f30c968b136
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cf2bb2295389d228b4718e9cb19bfa0699373ac65d3072f2bfe511557005e8128936269a6de657f959a3edd2001645574688e319a515c8eb1fb289c397f5cdd
|
7
|
+
data.tar.gz: 8d68383d8af3a2b93ed050b7fe77bcb5b3a32fcd7a33573b4cfaeddc13ee495b7bdebb8eb8609cb77fe0b04bd6a05a249cfefb0a3f8313c11b2fcd51376530ef
|
data/README.md
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# SnitchReporting
|
2
|
-
|
2
|
+
Snitch Reporting adds middleware to your Rails app to automatically track errors.
|
3
|
+
This is a self-hosted gem that plugs directly into your app.
|
3
4
|
|
4
5
|
## Usage
|
5
|
-
|
6
|
+
Install the gem, run the migrations, add to your middleware, then mount the route to view. Let the gem find and track your bugs for you!
|
6
7
|
|
7
8
|
## Installation
|
8
9
|
Add this line to your application's Gemfile:
|
@@ -21,8 +22,27 @@ Or install it yourself as:
|
|
21
22
|
$ gem install snitch_reporting
|
22
23
|
```
|
23
24
|
|
25
|
+
Add the migrations to your app with
|
26
|
+
```bash
|
27
|
+
rails g snitch_reporting:install
|
28
|
+
rails db:migrate
|
29
|
+
```
|
30
|
+
|
31
|
+
Add the middleware to your app by including the following in your application.rb
|
32
|
+
```ruby
|
33
|
+
Rails.application.config.middleware.use SnitchReporting::Rack, ->(occurrence) {
|
34
|
+
# Use the `occurrence` and `occurrence.report` to retrieve the info and notify to your reception box of choice, whether it be Email, SMS, Slack, or some other API.
|
35
|
+
}
|
36
|
+
```
|
37
|
+
|
24
38
|
## Contributing
|
25
|
-
|
39
|
+
Lots of things to do, and would love some PRs! Feel free to pull the code down and submit a PR with some changes.
|
40
|
+
A few things I'd like to do:
|
41
|
+
|
42
|
+
[] Track/display how many unique users are affected by the error
|
43
|
+
[] Visually graph history of the error
|
44
|
+
[] Add commenting capabilities
|
45
|
+
[] Track history of changes, whether they be marking as resolved, commenting, etc.
|
26
46
|
|
27
47
|
## License
|
28
48
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
@@ -0,0 +1,60 @@
|
|
1
|
+
document.addEventListener("change", function(evt) {
|
2
|
+
if (evt.target && evt.target.hasAttribute("data-mark-resolution-url")) {
|
3
|
+
var report_url = evt.target.getAttribute("data-mark-resolution-url")
|
4
|
+
var data = JSON.stringify({
|
5
|
+
snitch_report: {
|
6
|
+
resolved: evt.target.checked
|
7
|
+
}
|
8
|
+
})
|
9
|
+
|
10
|
+
fetch(report_url, {
|
11
|
+
headers: {
|
12
|
+
"Accept": "application/json",
|
13
|
+
"Content-Type": "application/json",
|
14
|
+
"X-CSRF-Token": document.querySelector("meta[name='csrf-token']").content
|
15
|
+
},
|
16
|
+
method: "PATCH",
|
17
|
+
body: data
|
18
|
+
})
|
19
|
+
}
|
20
|
+
})
|
21
|
+
|
22
|
+
// Must include Jquery
|
23
|
+
// Or rewrite to use pure JS
|
24
|
+
// $(document).ready(function() {
|
25
|
+
//
|
26
|
+
// function revealStacktrace() {
|
27
|
+
// $(".occurrence-details").addClass("hidden")
|
28
|
+
// $(window.location.hash).removeClass("hidden")
|
29
|
+
// $(".reveal-occurrence").removeClass("selected")
|
30
|
+
//
|
31
|
+
// if (window.location.hash == "") {
|
32
|
+
// $(".occurrence-details").first().removeClass("hidden")
|
33
|
+
// } else {
|
34
|
+
// $(".reveal-occurrence[href='" + window.location.hash + "']").addClass("selected")
|
35
|
+
// }
|
36
|
+
// }
|
37
|
+
// revealStacktrace()
|
38
|
+
//
|
39
|
+
// $(".reveal-occurrence").click(function() {
|
40
|
+
// // We want the hash/anchor to be updated before running the function
|
41
|
+
// setTimeout(revealStacktrace, 100)
|
42
|
+
// })
|
43
|
+
//
|
44
|
+
// $(".open-compressed").click(function(evt) {
|
45
|
+
// evt.preventDefault()
|
46
|
+
// $("[data-wrapname=" + $(this).attr("data-target") + "]").toggleClass("open")
|
47
|
+
// })
|
48
|
+
//
|
49
|
+
// $(".update-dropdown").change(function(evt) {
|
50
|
+
// var report_data = { bug_report: {} }
|
51
|
+
// report_data.bug_report[$(this).attr("data-name")] = $(this).val()
|
52
|
+
//
|
53
|
+
// $.ajax({
|
54
|
+
// method: "PATCH",
|
55
|
+
// url: $(this).attr("data-url"),
|
56
|
+
// data: report_data,
|
57
|
+
// dataType: "json"
|
58
|
+
// })
|
59
|
+
// })
|
60
|
+
// })
|
@@ -0,0 +1,120 @@
|
|
1
|
+
todo {
|
2
|
+
animation: 1.5s todo-pulse infinite;
|
3
|
+
}
|
4
|
+
@keyframes todo-pulse {
|
5
|
+
0% {
|
6
|
+
transform: scale(1);
|
7
|
+
}
|
8
|
+
|
9
|
+
50% {
|
10
|
+
transform: scale(1.01);
|
11
|
+
background: orange;
|
12
|
+
}
|
13
|
+
|
14
|
+
100% {
|
15
|
+
transform: scale(1);
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
.snitch-center {
|
20
|
+
text-align: center;
|
21
|
+
}
|
22
|
+
|
23
|
+
.scrollable {
|
24
|
+
margin: 0;
|
25
|
+
padding: 0;
|
26
|
+
width: 100%;
|
27
|
+
height: 100%;
|
28
|
+
overflow: auto;
|
29
|
+
}
|
30
|
+
|
31
|
+
.flex-row {
|
32
|
+
display: flex;
|
33
|
+
display: 100%;
|
34
|
+
align-items: center;
|
35
|
+
justify-content: space-between;
|
36
|
+
}
|
37
|
+
|
38
|
+
.snitch-banner {
|
39
|
+
box-shadow: 2px 2px 4px $border-grey;
|
40
|
+
border-radius: 8px;
|
41
|
+
background: green;
|
42
|
+
padding: 15px;
|
43
|
+
color: white;
|
44
|
+
text-align: center;
|
45
|
+
}
|
46
|
+
|
47
|
+
.line-trace {
|
48
|
+
margin: 20px 0;
|
49
|
+
background: #E0DFDF;
|
50
|
+
padding: 10px;
|
51
|
+
overflow: scroll;
|
52
|
+
|
53
|
+
&.cap-height {
|
54
|
+
max-height: 300px;
|
55
|
+
}
|
56
|
+
|
57
|
+
.trace-details {
|
58
|
+
margin: 10px;
|
59
|
+
|
60
|
+
.trace-full {
|
61
|
+
color: grey;
|
62
|
+
font-size: 12px;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
.current-line {
|
67
|
+
background: lighten($snitch-blue, 25%);
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
code {
|
72
|
+
overflow: scroll;
|
73
|
+
white-space: pre;
|
74
|
+
}
|
75
|
+
|
76
|
+
.snitch-resolution-switch {
|
77
|
+
-webkit-appearance: none;
|
78
|
+
-moz-appearance: none;
|
79
|
+
appearance: none;
|
80
|
+
display: inline-block;
|
81
|
+
position: relative;
|
82
|
+
transition: background-color ease 0.3s;
|
83
|
+
cursor: pointer;
|
84
|
+
outline: none;
|
85
|
+
border: none;
|
86
|
+
background-color: #707070;
|
87
|
+
width: 120px;
|
88
|
+
height: 32px;
|
89
|
+
overflow: hidden;
|
90
|
+
|
91
|
+
&:before {
|
92
|
+
display: block;
|
93
|
+
position: absolute;
|
94
|
+
top: 2px;
|
95
|
+
left: 2px;
|
96
|
+
z-index: 2;
|
97
|
+
transition: 0.4s;
|
98
|
+
box-shadow: 0 1px 2px rgba(0,0,0,0.2);
|
99
|
+
background: #fff;
|
100
|
+
width: 28px;
|
101
|
+
height: 28px;
|
102
|
+
color: #fff;
|
103
|
+
font: 10px/28px Helvetica;
|
104
|
+
font-weight: bold;
|
105
|
+
text-indent: -70px;
|
106
|
+
text-shadow: -1px -1px rgba(0,0,0,0.15);
|
107
|
+
text-transform: uppercase;
|
108
|
+
white-space: nowrap;
|
109
|
+
word-spacing: 52px;
|
110
|
+
content: "Resolved Unresolved";
|
111
|
+
}
|
112
|
+
|
113
|
+
&:checked {
|
114
|
+
background-color: #4CD964;
|
115
|
+
}
|
116
|
+
|
117
|
+
&:checked:before {
|
118
|
+
left: 90px;
|
119
|
+
}
|
120
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
* { box-sizing: border-box; }
|
2
|
+
|
3
|
+
.snitch-reporting {
|
4
|
+
position: relative;
|
5
|
+
margin: 0;
|
6
|
+
padding: 50px;
|
7
|
+
padding-top: 100px;
|
8
|
+
width: 100%;
|
9
|
+
height: 100%;
|
10
|
+
color: $text-color;
|
11
|
+
font-family: Helvetica;
|
12
|
+
|
13
|
+
h1, h2, h3, h4, h5 { color: darken($snitch-blue, 10%); }
|
14
|
+
|
15
|
+
.snitch-skinny-container {
|
16
|
+
margin: 0 40px;
|
17
|
+
}
|
18
|
+
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
.snitch-reporting {
|
2
|
+
.snitch-btn {
|
3
|
+
display: inline-block;
|
4
|
+
position: relative;
|
5
|
+
box-sizing: border-box;
|
6
|
+
margin: 2px;
|
7
|
+
border: 1px solid $border-grey;
|
8
|
+
border-radius: 6px;
|
9
|
+
background: linear-gradient(white, $background-grey);
|
10
|
+
padding: 8px;
|
11
|
+
color: $text-color;
|
12
|
+
text-decoration: none;
|
13
|
+
|
14
|
+
&:hover {
|
15
|
+
background: linear-gradient($background-grey, $background-grey, white);
|
16
|
+
}
|
17
|
+
|
18
|
+
&.danger {
|
19
|
+
background: linear-gradient($danger, darken($danger, 15%));
|
20
|
+
color: white;
|
21
|
+
|
22
|
+
&:hover {
|
23
|
+
background: linear-gradient(darken($danger, 15%), $danger, $danger);
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
&.primary {
|
28
|
+
background: linear-gradient($snitch-blue, darken($snitch-blue, 15%));
|
29
|
+
color: white;
|
30
|
+
|
31
|
+
&:hover {
|
32
|
+
background: linear-gradient(darken($snitch-blue, 15%), $snitch-blue, $snitch-blue);
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
.snitch-reporting {
|
2
|
+
.snitch-nav {
|
3
|
+
position: fixed;
|
4
|
+
top: 0;
|
5
|
+
right: 0;
|
6
|
+
left: 0;
|
7
|
+
z-index: 1000;
|
8
|
+
background: $snitch-blue;
|
9
|
+
height: 50px;
|
10
|
+
|
11
|
+
.nav-tab,
|
12
|
+
a {
|
13
|
+
display: inline-block;
|
14
|
+
vertical-align: top;
|
15
|
+
margin: 0;
|
16
|
+
padding: 0 20px;
|
17
|
+
height: 100%;
|
18
|
+
color: white;
|
19
|
+
font-size: 18px;
|
20
|
+
font-weight: normal;
|
21
|
+
line-height: 50px;
|
22
|
+
text-decoration: none;
|
23
|
+
white-space: nowrap;
|
24
|
+
|
25
|
+
input {
|
26
|
+
border-radius: 0;
|
27
|
+
font-size: 18px;
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
a:hover {
|
32
|
+
background: lighten($snitch-blue, 10%);
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
.snitch-breadcrumbs {}
|
37
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
@import "*";
|
@@ -0,0 +1,127 @@
|
|
1
|
+
.snitch-reporting {
|
2
|
+
.snitch-table {
|
3
|
+
display: table;
|
4
|
+
border-spacing: 0 0;
|
5
|
+
background: white;
|
6
|
+
width: 100%;
|
7
|
+
max-width: 100%;
|
8
|
+
overflow: hidden;
|
9
|
+
|
10
|
+
&.fixed {
|
11
|
+
table-layout: fixed;
|
12
|
+
}
|
13
|
+
|
14
|
+
.snitch-thead {
|
15
|
+
display: table-header-group;
|
16
|
+
}
|
17
|
+
|
18
|
+
.snitch-tbody {
|
19
|
+
display: table-row-group;
|
20
|
+
}
|
21
|
+
|
22
|
+
.snitch-tr {
|
23
|
+
display: table-row;
|
24
|
+
}
|
25
|
+
|
26
|
+
.snitch-td,
|
27
|
+
.snitch-th {
|
28
|
+
display: table-cell;
|
29
|
+
border: 1px solid $border-grey;
|
30
|
+
|
31
|
+
max-width: 100%;
|
32
|
+
overflow: hidden;
|
33
|
+
text-align: left;
|
34
|
+
|
35
|
+
&.text-center {
|
36
|
+
text-align: center;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
.link-cell {
|
41
|
+
color: $text-color;
|
42
|
+
text-decoration: none;
|
43
|
+
|
44
|
+
&:hover {
|
45
|
+
background: darken($background-grey, 5%);
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
&.bordered {
|
50
|
+
.snitch-tbody .snitch-tr:nth-child(odd) {
|
51
|
+
background: $background-grey;
|
52
|
+
}
|
53
|
+
}
|
54
|
+
|
55
|
+
&.padded {
|
56
|
+
.link-cell,
|
57
|
+
.snitch-td,
|
58
|
+
.snitch-th {
|
59
|
+
padding: 20px;
|
60
|
+
}
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
.snitch-errors {
|
65
|
+
.report-title-wrapper {
|
66
|
+
margin-bottom: 5px;
|
67
|
+
|
68
|
+
.report-title {
|
69
|
+
color: $snitch-blue;
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
.report-location {
|
74
|
+
display: inline-block;
|
75
|
+
color: orange;
|
76
|
+
}
|
77
|
+
|
78
|
+
.report-message {
|
79
|
+
padding-top: 5px;
|
80
|
+
color: grey;
|
81
|
+
}
|
82
|
+
}
|
83
|
+
|
84
|
+
.snitch-section {
|
85
|
+
&#summary {
|
86
|
+
.snitch-table {
|
87
|
+
.snitch-td:first-of-type {
|
88
|
+
background: $background-grey;
|
89
|
+
width: 100px;
|
90
|
+
color: #AAA;
|
91
|
+
font-size: 12px;
|
92
|
+
text-align: right;
|
93
|
+
}
|
94
|
+
}
|
95
|
+
}
|
96
|
+
}
|
97
|
+
|
98
|
+
.filters {
|
99
|
+
text-align: center;
|
100
|
+
|
101
|
+
.filter-table {
|
102
|
+
display: inline-block;
|
103
|
+
vertical-align: top;
|
104
|
+
width: 300px;
|
105
|
+
|
106
|
+
.link-cell,
|
107
|
+
.snitch-td,
|
108
|
+
.snitch-th {
|
109
|
+
padding: 10px;
|
110
|
+
width: 300px;
|
111
|
+
}
|
112
|
+
|
113
|
+
.snitch-th {
|
114
|
+
text-align: center;
|
115
|
+
}
|
116
|
+
|
117
|
+
.snitch-td {
|
118
|
+
font-size: 14px;
|
119
|
+
|
120
|
+
&.selected {
|
121
|
+
background: darken($background-grey, 10%);
|
122
|
+
}
|
123
|
+
}
|
124
|
+
}
|
125
|
+
}
|
126
|
+
|
127
|
+
}
|