rorvswild 1.11.1 → 1.12.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 78dcaca37ba08f20d8b6fa091902f46973d48db05feabce1ab4600bd4afb48c3
4
- data.tar.gz: 626507452a31fe1e63fab2826d239c4d13f03c36e8bda1690deb1ba766733bc6
3
+ metadata.gz: aad78fe6a4f76f5ab203bfdac53ee50784937c831ecd6962ad989b1405da73d6
4
+ data.tar.gz: 934a28615a02c898be0900bbc653046e3ee42bc32a9131bc77941d638f1ef468
5
5
  SHA512:
6
- metadata.gz: 89a838d0e59c7a552ef0b961efe32420e9f271dbff74ca9427be809dc07b8a5b6158be53c10aac5bb3c69cfb6d1682e034b5b3d5f01898814e68f2443b3ffa6e
7
- data.tar.gz: 35e531b0cfe704c0641ac075713893a46a55aefd453cc6fea5a34f2f3b814639096834bb8e9a9adfb11d2041693282da525a2e2b47c3d8c830e9003050e43bdd
6
+ metadata.gz: 46a96c5adcf10ed9880ab1f4443ee7dedd63f980d6ca99f783194508c2de1c51b6d4ff6f548a257b92a512548f540a6a891e81d6c8ecfc2c138333ba0869492c
7
+ data.tar.gz: 9057e7e13be4db2f4a164347336436b332180cc1d588292069e69d7c907f084503df4d7bb29e35e725ae62ab1c69bf3c67d5ac18d28725c32fef572a9f3ae85d
data/bin/test ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -euo pipefail
4
+
5
+ RAILS_VERSION=${RAILS_VERSION:-8.1}
6
+ export BUNDLE_GEMFILE="gemfiles/rails-$RAILS_VERSION.gemfile"
7
+ bundle install && bundle exec rake
data/bin/test-matrix ADDED
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -euo pipefail
4
+
5
+ matrix=(
6
+ "8.1 4.0.5"
7
+ "8.1 3.4.10"
8
+ "8.1 3.3.11"
9
+ "8.1 3.2.11"
10
+
11
+ "8.0 4.0.5"
12
+ "8.0 3.4.10"
13
+ "8.0 3.3.11"
14
+ "8.0 3.2.11"
15
+
16
+ "7.2 4.0.5"
17
+ "7.2 3.4.10"
18
+ "7.2 3.3.11"
19
+ "7.2 3.2.11"
20
+ "7.2 3.1.7"
21
+
22
+ "7.1 3.3.11"
23
+ "7.1 2.7.8"
24
+
25
+ "7.0 3.3.11"
26
+ "7.0 2.7.8"
27
+
28
+ "6.1 2.5.9"
29
+ "6.0 2.5.9"
30
+ )
31
+
32
+ for entry in "${matrix[@]}"; do
33
+ IFS=' ' read -r RAILS_VERSION RUBY_VERSION <<< "$entry"
34
+ echo -e "\n---> RAILS_VERSION=$RAILS_VERSION RUBY_VERSION=$RUBY_VERSION\n"
35
+ export RBENV_VERSION=$RUBY_VERSION
36
+ export RAILS_VERSION
37
+ export RUBY_VERSION
38
+ "$(dirname "$0")/test"
39
+ done
@@ -45,7 +45,7 @@ module RorVsWild
45
45
  end
46
46
 
47
47
  def self.to_h
48
- @to_h ||= {revision: revision, description: description, author: author, email: email, ruby: ruby, rails: rails, rorvswild: rorvswild}.compact
48
+ {revision: revision, description: description, author: author, email: email, ruby: ruby, rails: rails, rorvswild: rorvswild}.compact
49
49
  end
50
50
 
51
51
  def self.read
@@ -56,8 +56,8 @@ module RorVsWild
56
56
 
57
57
  def self.read_from_heroku
58
58
  return unless ENV["HEROKU_SLUG_COMMIT"]
59
- @revision = ENV["HEROKU_SLUG_COMMIT"]
60
59
  @description = ENV["HEROKU_SLUG_DESCRIPTION"]
60
+ @revision = ENV["HEROKU_SLUG_COMMIT"]
61
61
  end
62
62
 
63
63
  def self.read_from_scalingo
@@ -80,8 +80,7 @@ module RorVsWild
80
80
  end
81
81
 
82
82
  def self.read_from_kamal
83
- return unless ENV["KAMAL_VERSION"]
84
- @revision = ENV["KAMAL_VERSION"]
83
+ @revision = ENV["KAMAL_VERSION"] if ENV["KAMAL_VERSION"]
85
84
  end
86
85
 
87
86
  def self.normalize_string(string)
@@ -13,14 +13,14 @@ RorVsWild.Local = function(container) {
13
13
 
14
14
  RorVsWild.Local.prototype.getRequests = function(callback) {
15
15
  this.getJson("/rorvswild/requests.json", function(data) {
16
- this.requests = data.map(function(attributes) { return new RorVsWild.Local.Request(attributes) })
16
+ this.requests = data.map(function(attributes) { return new RorVsWild.Local.Execution(attributes) })
17
17
  callback()
18
18
  }.bind(this))
19
19
  }
20
20
 
21
21
  RorVsWild.Local.prototype.getJobs = function(callback) {
22
22
  this.getJson("/rorvswild/jobs.json", function(data) {
23
- this.jobs = data.map(function(attributes) { return new RorVsWild.Local.Request(attributes) })
23
+ this.jobs = data.map(function(attributes) { return new RorVsWild.Local.Execution(attributes) })
24
24
  callback()
25
25
  }.bind(this))
26
26
  }
@@ -54,7 +54,6 @@ RorVsWild.Local.prototype.getJson = function(path, callback) {
54
54
  RorVsWild.Local.prototype.render = function(view) {
55
55
  this.view = view
56
56
  Barber.render("RorVsWild.Local", this, this.root)
57
- Prism.highlightAllUnder(this.root)
58
57
  }
59
58
 
60
59
  RorVsWild.Local.prototype.renderBody = function() {
@@ -70,20 +69,20 @@ RorVsWild.Local.prototype.toggle = function(event) {
70
69
  this.active ? this.collapse() : this.expand(event)
71
70
  }
72
71
 
73
- RorVsWild.Local.prototype.toggleCommand = function(event) {
74
- document.querySelector(event.currentTarget.dataset.target).classList.toggle("is-open")
75
- }
76
-
77
- RorVsWild.Local.prototype.toggleLowImpactSections = function(event) {
78
- var button = event.currentTarget
79
- var sections = document.querySelectorAll(".rorvswild-local-panel__details__section[data-low-impact]")
80
- var isHidden = sections[0].classList.contains("is-hidden")
81
-
82
- sections.forEach(function(section) {
83
- section.classList.toggle("is-hidden")
84
- })
85
-
86
- button.textContent = isHidden ? "↑ Hide low impact sections" : "↓ View low impact sections"
72
+ RorVsWild.Local.highlightMatches = function(text, query) {
73
+ if (query.length < 1)
74
+ return Mustache.escape(text)
75
+ var lower = text.toLowerCase()
76
+ var result = "", start = 0, index
77
+ while ((index = lower.indexOf(query, start)) !== -1) {
78
+ result += Mustache.escape(text.slice(start, index))
79
+ result += '<mark class="rorvswild-local-panel__section-filter-highlight">'
80
+ result += Mustache.escape(text.slice(index, index + query.length))
81
+ result += "</mark>"
82
+ start = index + query.length
83
+ }
84
+ result += Mustache.escape(text.slice(start))
85
+ return result
87
86
  }
88
87
 
89
88
  RorVsWild.Local.prototype.expand = function() {
@@ -126,11 +125,17 @@ RorVsWild.Local.formatDateTime = function(date) {
126
125
  return [date.getDate(), months[date.getMonth()], hours + ":" + minutes].join(" ")
127
126
  }
128
127
 
128
+ RorVsWild.Local.prototype.goToExecutionDetail = function(execution) {
129
+ this.currentExecution = execution
130
+ execution.resetSectionFilters()
131
+ execution.loadSections()
132
+ this.render("Execution")
133
+ execution.renderSections()
134
+ }
135
+
129
136
  RorVsWild.Local.prototype.goToRequestDetail = function(event) {
130
- this.root.dataset.tab = "requests"
131
137
  var uuid = event.currentTarget.dataset.uuid
132
- this.currentRequest = this.requests.find(function(req) { return req.uuid == uuid })
133
- this.render("RequestDetail")
138
+ this.goToExecutionDetail(this.requests.find(function(req) { return req.uuid == uuid }))
134
139
  }
135
140
 
136
141
  RorVsWild.Local.prototype.goToRequestIndex = function(event) {
@@ -145,8 +150,7 @@ RorVsWild.Local.prototype.goToJobIndex = function(event) {
145
150
 
146
151
  RorVsWild.Local.prototype.goToJobDetail = function(event) {
147
152
  var uuid = event.currentTarget.dataset.uuid
148
- this.currentJob = this.jobs.find(function(job) { return job.uuid == uuid })
149
- this.render("JobDetail")
153
+ this.goToExecutionDetail(this.jobs.find(function(job) { return job.uuid == uuid }))
150
154
  }
151
155
 
152
156
  RorVsWild.Local.prototype.goToErrors = function(event) {
@@ -158,6 +162,7 @@ RorVsWild.Local.prototype.goToErrorDetail = function(event) {
158
162
  var uuid = event.currentTarget.dataset.uuid
159
163
  this.currentError = this.errors.find(function(err) { return err.uuid == uuid })
160
164
  this.render("ErrorDetail")
165
+ Prism.highlightAllUnder(this.root)
161
166
  }
162
167
 
163
168
  RorVsWild.Local.prototype.containerClass = function() {
@@ -187,24 +192,48 @@ RorVsWild.Local.nextId = function() {
187
192
  return RorVsWild.Local.lastId += 1
188
193
  }
189
194
 
190
- RorVsWild.Local.Request = function(data) {
195
+ RorVsWild.Local.Execution = function(data) {
191
196
  this.data = data
192
197
  this.uuid = data.uuid
193
198
  this.name = data.name
194
199
  this.path = data.path
195
200
  this.queuedAt = RorVsWild.Local.formatDateTime(new Date(data.queued_at))
201
+ this.sections = []
196
202
  }
197
203
 
198
- RorVsWild.Local.Request.prototype.runtime = function() {
204
+ RorVsWild.Local.Execution.prototype.runtime = function() {
199
205
  return RorVsWild.Local.relevantRounding(this.data.runtime)
200
206
  }
201
207
 
202
- RorVsWild.Local.Request.prototype.sections = function() {
203
- return this.data.sections.map(function(section) {
208
+ RorVsWild.Local.Execution.prototype.resetSectionFilters = function() {
209
+ this.sectionKindFilter = null
210
+ this.sectionQueryFilter = ""
211
+ this.lowImpactExpanded = false
212
+ }
213
+
214
+ RorVsWild.Local.Execution.prototype.isFilteringSections = function() {
215
+ return this.sectionKindFilter != null || this.sectionQueryFilter.length > 0
216
+ }
217
+
218
+ RorVsWild.Local.Execution.prototype.filterSections = function() {
219
+ var kind = this.sectionKindFilter
220
+ var query = this.sectionQueryFilter
221
+ var filtering = this.isFilteringSections()
222
+
223
+ return this.sections.filter(function(section) {
224
+ return (!kind || section.kind === kind)
225
+ && (query.length < 1 || section.location.toLowerCase().indexOf(query) !== -1)
226
+ && (filtering || this.lowImpactExpanded || !section.isLowImpact)
227
+ }.bind(this))
228
+ }
229
+
230
+ RorVsWild.Local.Execution.prototype.loadSections = function() {
231
+ this.sections = this.data.sections.map(function(section) {
204
232
  var runtime = (section.total_runtime - section.children_runtime)
205
233
  var impactValue = runtime * 100 / this.data.runtime
206
234
  return {
207
235
  id: RorVsWild.Local.nextId(),
236
+ isOpen: false,
208
237
  impact: RorVsWild.Local.formatImpact(impactValue),
209
238
  isLowImpact: impactValue < 1,
210
239
  language: RorVsWild.Local.kindToLanguage(section.kind),
@@ -219,27 +248,92 @@ RorVsWild.Local.Request.prototype.sections = function() {
219
248
  kind: section.kind.substring(0, 7),
220
249
  file: section.file,
221
250
  line: section.line,
222
- isLineRelevant: section.line > 0,
223
- location: section.kind == "view" ? section.file : section.file + ":" + section.line,
251
+ location: section.file + (section.line > 0 ? ":" + section.line : ""),
224
252
  locationUrl: RorVsWild.Local.pathToUrl(this.data.environment.cwd, section.file, section.line),
225
253
  isAsync: RorVsWild.Local.relevantRounding(section.async_runtime) > 0,
226
254
  }
227
255
  }.bind(this)).sort(function(a, b) { return b.selfRuntime - a.selfRuntime })
228
256
  }
229
257
 
230
- RorVsWild.Local.Request.prototype.hasLowImpactSections = function() {
231
- return this.sections().some(function(section) { return section.isLowImpact })
232
- }
258
+ RorVsWild.Local.Execution.prototype.sectionsImpactPerKind = function() {
259
+ if (!this.sections.length) return []
233
260
 
234
- RorVsWild.Local.Request.prototype.sectionsImpactPerKind = function() {
235
261
  var total = 0
236
- var perKind = this.sections().reduce(function(object, section) {
262
+ var perKind = this.sections.reduce(function(object, section) {
237
263
  object[section.kind] = (object[section.kind] || 0) + section.runtime
238
264
  total += section.runtime
239
265
  return object
240
266
  }, {})
241
267
  return Object.entries(perKind).sort(function(a, b) { return b[1] - a[1] })
242
- .map(function(item) { return {kind: item[0], impact: Math.round((item[1] / total * 100) * 10) / 10} })
268
+ .map(function(item) {
269
+ return {
270
+ kind: item[0],
271
+ impact: Math.round((item[1] / total * 100) * 10) / 10,
272
+ isActive: item[0] === this.sectionKindFilter
273
+ }
274
+ }.bind(this))
275
+ }
276
+
277
+ RorVsWild.Local.Execution.prototype.showLowImpactToggle = function() {
278
+ return !this.isFilteringSections() && this.sections.some(function(section) { return section.isLowImpact })
279
+ }
280
+
281
+ RorVsWild.Local.Execution.prototype.lowImpactToggleLabel = function() {
282
+ return this.lowImpactExpanded ? "↑ Hide low impact sections" : "↓ View low impact sections"
283
+ }
284
+
285
+ RorVsWild.Local.Execution.prototype.renderSectionHeader = function() {
286
+ var container = document.querySelector("#rorvswild-local-sections-header")
287
+ if (!container) return
288
+
289
+ Barber.render("RorVsWild.Local.Sections.Header", this, container)
290
+ }
291
+
292
+ RorVsWild.Local.Execution.prototype.renderSectionList = function() {
293
+ (this.filteredSections = this.filterSections()).forEach(function(section) {
294
+ section.locationHtml = RorVsWild.Local.highlightMatches(section.location, this.sectionQueryFilter)
295
+ }.bind(this))
296
+
297
+ var container = document.querySelector("#rorvswild-local-sections-list")
298
+ Barber.render("RorVsWild.Local.Sections.List", this, container)
299
+
300
+ this.filteredSections.forEach(function(section) {
301
+ section.isOpen && Prism.highlightAllUnder(container.querySelector("#section-" + section.id))
302
+ })
303
+ }
304
+
305
+ RorVsWild.Local.Execution.prototype.renderSections = function() {
306
+ this.renderSectionHeader()
307
+ this.renderSectionList()
308
+ }
309
+
310
+ RorVsWild.Local.Execution.prototype.toggleSection = function(event) {
311
+ var id = parseInt(event.currentTarget.dataset.sectionId, 10)
312
+ var section = this.sections.find(function(section) { return section.id === id })
313
+ if (!section) return
314
+
315
+ section.isOpen = !section.isOpen
316
+ var element = event.currentTarget.closest(".rorvswild-local-panel__details__section")
317
+ element.classList.toggle("is-open", section.isOpen)
318
+ if (section.isOpen)
319
+ Prism.highlightAllUnder(element)
320
+ }
321
+
322
+ RorVsWild.Local.Execution.prototype.toggleLowImpactSections = function() {
323
+ this.lowImpactExpanded = !this.lowImpactExpanded
324
+ this.renderSectionList()
325
+ }
326
+
327
+ RorVsWild.Local.Execution.prototype.filterSectionsByText = function(event) {
328
+ this.sectionQueryFilter = event.currentTarget.value.trim().toLowerCase()
329
+ this.renderSectionList()
330
+ }
331
+
332
+ RorVsWild.Local.Execution.prototype.filterSectionsByKind = function(event) {
333
+ var kind = event.currentTarget.dataset.kind
334
+ this.sectionKindFilter = this.sectionKindFilter === kind ? null : kind
335
+ this.renderSectionHeader()
336
+ this.renderSectionList()
243
337
  }
244
338
 
245
339
  RorVsWild.Local.Error = function(data) {
@@ -82,7 +82,7 @@
82
82
  <h2 class="rorvswild-local-panel--blank">No jobs</h2>
83
83
  {{/jobs}}
84
84
  {{#jobs}}
85
- <div data-events="click->goToJobDetail" data-uuid="{{uuid}}"" class="rorvswild-local-panel__row">
85
+ <div data-events="click->goToJobDetail" data-uuid="{{uuid}}" class="rorvswild-local-panel__row">
86
86
  <div class="rorvswild-local-panel__name">
87
87
  <span>{{name}}</span>
88
88
  <div class="rorvswild-local-panel__path">{{path}}</div>
@@ -106,8 +106,8 @@
106
106
  </div>
107
107
  </script>
108
108
 
109
- <script type="x-tmpl-mustache" data-partial="RorVsWild.Local.RequestDetail">
110
- {{#currentRequest}}
109
+ <script type="x-tmpl-mustache" data-partial="RorVsWild.Local.Execution">
110
+ {{#currentExecution}}
111
111
  <div class="rorvswild-local-panel__details">
112
112
  <div class="rorvswild-local-panel__details__header">
113
113
  <span class="rorvswild-local-panel__name">
@@ -119,65 +119,49 @@
119
119
  <span class="rorvswild-local-panel__runtime">{{runtime}}<small>ms</small></span>
120
120
  <span class="rorvswild-local-panel__started-at">{{queuedAt}}</span>
121
121
  </div>
122
- {{> RorVsWild.Local.Sections}}
123
- </div>
124
- {{/currentRequest}}
125
- </script>
126
-
127
- <script type="x-tmpl-mustache" data-partial="RorVsWild.Local.JobDetail">
128
- {{#currentJob}}
129
- <div class="rorvswild-local-panel__details">
130
- <div class="rorvswild-local-panel__details__header">
131
- <span class="rorvswild-local-panel__name">
132
- <h2 class="rorvswild-local-panel__title">{{name}}</h2>
133
- <span class="rorvswild-local-panel__path">
134
- {{path}}
135
- </span>
136
- </span>
137
- <span class="rorvswild-local-panel__runtime">{{runtime}}<small>ms</small></span>
138
- <span class="rorvswild-local-panel__started-at">{{queuedAt}}</span>
122
+ <div class="rorvswild-local-panel__details__sections">
123
+ <div id="rorvswild-local-sections-header"></div>
124
+ <div id="rorvswild-local-sections-list"></div>
139
125
  </div>
140
- {{> RorVsWild.Local.Sections}}
141
126
  </div>
142
- {{/currentJob}}
127
+ {{/currentExecution}}
143
128
  </script>
144
129
 
145
- <script type="x-tmpl-mustache" data-partial="RorVsWild.Local.Sections">
146
- <div class="rorvswild-local-panel__details__sections">
147
- {{> RorVsWild.Local.SectionImpactPerKind}}
148
- {{#sections}}
149
- {{> RorVsWild.Local.Section}}
150
- {{/sections}}
151
- {{#hasLowImpactSections}}
152
- <div class="rorvswild-local-panel__toggle-low-impact">
153
- <button data-events="click->toggleLowImpactSections" class="rorvswild-local-panel__toggle-low-impact__button">↓ view low impact sections</button>
154
- </div>
155
- {{/hasLowImpactSections}}
156
- </div>
157
- </script>
158
-
159
- <script type="x-tmpl-mustache" data-partial="RorVsWild.Local.SectionImpactPerKind">
130
+ <script type="x-tmpl-mustache" data-partial="RorVsWild.Local.Sections.Header">
160
131
  <ul class="rorvswild-local-panel__breakdown">
161
132
  {{#sectionsImpactPerKind}}
162
- <li style="width: {{impact}}%" title="{{kind}} {{impact}}%">
163
- <span class="rorvswild-local-panel__breakdown__label">{{kind}}</span> <span class="rorvswild-local-panel__breakdown__value">{{impact}}%</span>
133
+ <li class="{{#isActive}}is-active{{/isActive}}" style="width: {{impact}}%" title="{{kind}} {{impact}}%" data-events="click->filterSectionsByKind" data-kind="{{kind}}">
134
+ <span class="rorvswild-local-panel__breakdown__label">{{kind}}</span>
135
+ <span class="rorvswild-local-panel__breakdown__value">{{impact}}</span><small>%</small>
164
136
  </li>
165
137
  {{/sectionsImpactPerKind}}
166
138
  </ul>
139
+ <div class="rorvswild-local-panel__section-filter">
140
+ <input type="search" placeholder="Filter" value="{{sectionQueryFilter}}" data-events="input->filterSectionsByText" class="rorvswild-local-panel__section-filter__input">
141
+ </div>
142
+ </script>
143
+
144
+ <script type="x-tmpl-mustache" data-partial="RorVsWild.Local.Sections.List">
145
+ {{#filteredSections}}
146
+ {{> RorVsWild.Local.Section}}
147
+ {{/filteredSections}}
148
+ {{#showLowImpactToggle}}
149
+ <div class="rorvswild-local-panel__toggle-low-impact">
150
+ <button data-events="click->toggleLowImpactSections" class="rorvswild-local-panel__toggle-low-impact__button">{{lowImpactToggleLabel}}</button>
151
+ </div>
152
+ {{/showLowImpactToggle}}
167
153
  </script>
168
154
 
169
155
  <script type="x-tmpl-mustache" data-partial="RorVsWild.Local.Section">
170
- <div class="rorvswild-local-panel__details__section {{#isLowImpact}}is-hidden{{/isLowImpact}}" {{#isLowImpact}}data-low-impact{{/isLowImpact}} id="section-{{id}}">
156
+ <div class="rorvswild-local-panel__details__section{{#isOpen}} is-open{{/isOpen}}" data-kind="{{kind}}" id="section-{{id}}">
171
157
  <div class="rorvswild-local-panel__details__section__main">
172
158
  <span class="rorvswild-local-panel__details__section__file">
173
- <button data-events="click->toggleCommand" data-target="#section-{{id}}" class="rorvswild-local-panel__details__section__kind"><span>{{kind}}</button>
159
+ <button data-events="click->toggleSection" data-section-id="{{id}}" class="rorvswild-local-panel__details__section__kind"><span>{{kind}}</span></button>
174
160
  {{#locationUrl}}
175
- <a href="{{locationUrl}}" class="rorvswild-local-panel__file__name" title="Open in your editor">{{location}}</a>
161
+ <a href="{{locationUrl}}" class="rorvswild-local-panel__file__name" title="Open in your editor">{{{locationHtml}}}</a>
176
162
  {{/locationUrl}}
177
163
  {{^locationUrl}}
178
- <span class="rorvswild-local-panel__file__name">{{file}}
179
- {{#isLineRelevant}}<span>:{{line}}</span>{{/isLineRelevant}}
180
- </span>
164
+ <span class="rorvswild-local-panel__file__name">{{{locationHtml}}}</span>
181
165
  {{/locationUrl}}
182
166
  </span>
183
167
  <span class="rorvswild-local-panel__details__section__average" title="Self runtime">{{selfRuntime}}<small>ms</small></span>
@@ -228,7 +212,7 @@
228
212
  <div data-events="click->goToErrorDetail" data-uuid="{{uuid}}" class="rorvswild-local-panel__row rorvswild-local-panel__error">
229
213
  <div class="rorvswild-local-panel__name">
230
214
  <span>{{exception}}</span> {{shortMessage}}
231
- <div class="rorvswild-local-panel__path">{{file}}:{{line}}</div>
215
+ <div class="rorvswild-local-panel__path"><span class="rorvswild-local-panel__file__name">{{file}}<span>:{{line}}</span></span></div>
232
216
  </div>
233
217
  <span class="rorvswild-local-panel__started-at">{{queuedAt}}</span>
234
218
  </div>
@@ -241,14 +225,14 @@
241
225
  <div class="rorvswild-local-panel__details__header">
242
226
  <span class="rorvswild-local-panel__name">
243
227
  <h2 class="rorvswild-local-panel__title">{{exception}}</h2>
244
- <span class="rorvswild-local-panel__path">
228
+ <div class="rorvswild-local-panel__path">
245
229
  {{#locationUrl}}
246
- <a href="{{locationUrl}}" class="rorvswild-local-panel__file__name" title="Open in your editor">{{file}}:{{line}}</a>
230
+ <a href="{{locationUrl}}" class="rorvswild-local-panel__file__name" title="Open in your editor">{{file}}<span>:{{line}}</span></a>
247
231
  {{/locationUrl}}
248
232
  {{^locationUrl}}
249
- {{file}}:{{line}}
233
+ <span class="rorvswild-local-panel__file__name">{{file}}<span>:{{line}}</span></span>
250
234
  {{/locationUrl}}
251
- </span>
235
+ </div>
252
236
  </span>
253
237
  <span class="rorvswild-local-panel__started-at">{{queuedAt}}</span>
254
238
  </div>
@@ -31,19 +31,14 @@ module RorVsWild
31
31
 
32
32
  def serve_embed_profiler(env)
33
33
  status, headers, body = app.call(env)
34
- status = status.to_i
35
- if status >= 200 && status < 300 && headers["Content-Type"] && headers["Content-Type"].include?("text/html")
36
- if headers["Content-Encoding"]
37
- log_incompatible_middleware_warning
38
- elsif body.respond_to?(:each) && widget_position != "hidden"
39
- content_length = 0
40
- @current_request = RorVsWild.agent.queue.requests.first
41
- body.each do |string|
42
- inject_into(string)
43
- content_length += string.size
44
- end
45
- headers["Content-Length"] = content_length.to_s if headers["Content-Length"]
34
+ if widget_position != "hidden" && compatible_response_with_widget?(status.to_i, headers, body)
35
+ content_length = 0
36
+ @current_request = RorVsWild.agent.queue.requests.first
37
+ body.each do |string|
38
+ inject_into(string)
39
+ content_length += string.size
46
40
  end
41
+ headers["Content-Length"] = content_length.to_s if headers["Content-Length"]
47
42
  end
48
43
  [status, headers, body]
49
44
  end
@@ -74,6 +69,13 @@ module RorVsWild
74
69
 
75
70
  private
76
71
 
72
+ def compatible_response_with_widget?(status, headers, body)
73
+ headers["Content-Type"].respond_to?(:include?) && headers["Content-Type"].include?("text/html") &&
74
+ !headers["Content-Encoding"] && !headers["Transfer-Encoding"] &&
75
+ status >= 200 && status < 300 &&
76
+ body.respond_to?(:each)
77
+ end
78
+
77
79
  def widget_position
78
80
  (config = RorVsWild.agent.config) && config[:widget]
79
81
  end
@@ -125,12 +127,6 @@ module RorVsWild
125
127
  "<!DOCTYPE html>\n<html><head></head><body></body></html>".dup
126
128
  end
127
129
 
128
- def log_incompatible_middleware_warning
129
- RorVsWild.logger.warn("RorVsWild::Local cannot be embeded into your HTML page because of compression." +
130
- " Try to disable Rack::Deflater in development only." +
131
- " In the meantime just visit the /rorvswild page to see the profiler.")
132
- end
133
-
134
130
  def log_incompatible_encoding_warning(exception)
135
131
  RorVsWild.logger.warn("RorVsWild::Local cannot be embeded into your HTML page because of incompatible #{exception.message}." +
136
132
  " However you can just visit the /rorvswild page to see the profiler.")
@@ -19,7 +19,7 @@
19
19
  .rorvswild-local-toggler small {
20
20
  color: rgb(146 149 159) !important;
21
21
  font-weight: 400 !important;
22
- font-size: 10px !important;
22
+ font-size: 0.694em !important;
23
23
  margin-left: 4px !important;
24
24
  display: inline-block !important;
25
25
  }
@@ -50,7 +50,7 @@
50
50
  background: rgb(17 20 27) !important;
51
51
  color: rgb(199 203 214) !important;
52
52
  font-family: SF Mono, Menlo, Consolas, DejaVu Sans Mono, monospace !important;
53
- font-size: 15px !important;
53
+ font-size: 13px !important;
54
54
  line-height: 24px !important;
55
55
  position: fixed !important;
56
56
  top: 0 !important;
@@ -88,7 +88,7 @@
88
88
 
89
89
  .rorvswild-local-panel small {
90
90
  color: rgb(146 149 159) !important;
91
- font-size: 10px !important;
91
+ font-size: 0.694em !important;
92
92
  font-weight: 400 !important;
93
93
  margin-left: 2px !important;
94
94
  }
@@ -108,7 +108,7 @@
108
108
 
109
109
  .rorvswild-local-panel__header nav {
110
110
  text-transform: uppercase !important;
111
- font-size: 12px !important;
111
+ font-size: 0.833em !important;
112
112
  font-weight: 700 !important;
113
113
  letter-spacing: 1px !important;
114
114
  flex: 1 !important;
@@ -193,7 +193,7 @@
193
193
  .rorvswild-local-panel--blank {
194
194
  text-align: center !important;
195
195
  margin: 0 auto !important;
196
- font-size: 31px !important;
196
+ font-size: 2.074em !important;
197
197
  line-height: calc(100dvh - 120px) !important;
198
198
  color: rgb(26 29 36) !important;
199
199
  }
@@ -302,7 +302,7 @@
302
302
  h2.rorvswild-local-panel__title {
303
303
  margin:-18px 0 0 !important;
304
304
  padding:0 !important;
305
- font-size: 31px !important;
305
+ font-size: 2.074em !important;
306
306
  line-height: 48px !important;
307
307
  font-weight: 700 !important;
308
308
  font-family: SF Mono, Menlo, Consolas, DejaVu Sans Mono, monospace !important;
@@ -320,15 +320,28 @@ h2.rorvswild-local-panel__title {
320
320
  }
321
321
 
322
322
  .rorvswild-local-panel__breakdown li {
323
+ color: rgb(146 149 159) !important;
323
324
  display: inline-block !important;
324
325
  margin: 0 !important;
325
326
  padding: 0 8px !important;
326
327
  white-space: nowrap !important;
327
328
  overflow: hidden !important;
328
329
  border: 1px solid rgb(26 29 36) !important;
329
- font-size: 10px !important;
330
+ font-size: 0.694em !important;
330
331
  text-transform: uppercase !important;
331
332
  letter-spacing: 1px !important;
333
+ cursor: pointer !important;
334
+ transition: box-shadow 0.15s !important;
335
+ }
336
+
337
+ .rorvswild-local-panel__breakdown li:hover {
338
+ box-shadow: 0 0 0 1px rgb(72 75 80) inset !important;
339
+ color: rgb(199 203 214) !important;
340
+ }
341
+
342
+ .rorvswild-local-panel__breakdown li.is-active {
343
+ box-shadow: 0 0 0 1px rgb(199 203 214) inset !important;
344
+ color: rgb(199 203 214) !important;
332
345
  }
333
346
 
334
347
  .rorvswild-local-panel__breakdown li:first-of-type { background-color:rgba(199, 203, 214, .08) !important; }
@@ -345,16 +358,69 @@ h2.rorvswild-local-panel__title {
345
358
 
346
359
  .rorvswild-local-panel__breakdown__value { font-weight: 700; }
347
360
 
361
+ .rorvswild-local-panel__section-filter {
362
+ width: calc(100% - 24px) !important;
363
+ margin: 0 12px 12px !important;
364
+ }
365
+
366
+ .rorvswild-local-panel__section-filter__input {
367
+ width: 100% !important;
368
+ max-width: 240px !important;
369
+ transition: all 0.2s !important;
370
+ box-sizing: border-box !important;
371
+ margin: 0 !important;
372
+ padding: 0 8px !important;
373
+ border: 1px solid rgb(38 41 49) !important;
374
+ min-height: 24px !important;
375
+ height: 24px !important;
376
+ line-height: 24px !important;
377
+ border-radius: 4px !important;
378
+ background: rgb(26 29 36) !important;
379
+ color: rgb(199 203 214) !important;
380
+ font-family: inherit !important;
381
+ font-size: 0.833em !important;
382
+ }
383
+
384
+ .rorvswild-local-panel__section-filter__input:focus {
385
+ transition: all 0.2s !important;
386
+ outline: none !important;
387
+ border-color: rgb(72 75 80) !important;
388
+ background-color: rgb(13 15 21) !important;
389
+ box-shadow: 0 0 0 1px rgb(52 70 128) inset !important;
390
+ }
391
+
392
+ .rorvswild-local-panel__section-filter__input::-webkit-search-cancel-button {
393
+ -webkit-appearance: none;
394
+ appearance: none;
395
+ background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%2375777d' d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E");
396
+ background-size: 12px;
397
+ background-repeat: no-repeat;
398
+ background-position: center;
399
+ width: 16px;
400
+ height: 16px;
401
+ background-color: rgb(24 26 32);
402
+ border-radius: 50%;
403
+ cursor: pointer;
404
+ transition: background-color 0.2s ease;
405
+ }
406
+
407
+ .rorvswild-local-panel__section-filter__input::placeholder {
408
+ color: rgb(72 74 81) !important;
409
+ }
410
+
411
+ .rorvswild-local-panel__section-filter-highlight {
412
+ background: rgb(55 38 0) !important;
413
+ box-shadow: 0 0 0 1px rgb(96 70 0) inset !important;
414
+ padding: 0 !important;
415
+ border-radius: 2px !important;
416
+ }
417
+
348
418
  .rorvswild-local-panel__details__section {
349
419
  padding: 12px 12px 11px !important;
350
420
  border-bottom: 1px solid rgb(26 29 36) !important;
351
421
  display: block !important;
352
422
  }
353
423
 
354
- .rorvswild-local-panel__details__section.is-hidden {
355
- display: none !important;
356
- }
357
-
358
424
  .rorvswild-local-panel__details__section:hover {
359
425
  background: rgb(26 29 36) !important;
360
426
  transition: all .3s !important;
@@ -400,7 +466,9 @@ a.rorvswild-local-panel__file__name::after {
400
466
  a.rorvswild-local-panel__file__name:hover::after { opacity: 1; }
401
467
 
402
468
  .rorvswild-local-panel__file__name span {
403
- background: rgb(38 41 49);
469
+ box-shadow: 0 0 0 1px rgb(38 41 49) inset !important;
470
+ font-weight: 700 !important;
471
+ padding: 0 2px !important;
404
472
  text-decoration: none;
405
473
  display: inline-block;
406
474
  }
@@ -454,7 +522,7 @@ a.rorvswild-local-panel__file__name:hover::after { opacity: 1; }
454
522
  margin: 4px 0 0;
455
523
  text-transform: uppercase;
456
524
  letter-spacing: 1px;
457
- font-size: 9px !important;
525
+ font-size: 0.579em !important;
458
526
  line-height: 12px;
459
527
  font-weight: 400;
460
528
  }
@@ -471,7 +539,7 @@ a.rorvswild-local-panel__file__name:hover::after { opacity: 1; }
471
539
 
472
540
  .rorvswild-local-panel__details__section__kind {
473
541
  background: rgb(38 41 49);
474
- font-size: 10px !important;
542
+ font-size: 0.694em !important;
475
543
  text-transform: uppercase !important;
476
544
  text-align: center !important;
477
545
  letter-spacing: 1px !important;
@@ -552,7 +620,7 @@ span.rorvswild-local-panel__details__section__kind {
552
620
  color: rgb(146 149 159) !important;
553
621
  text-align: center;
554
622
  text-transform: uppercase;
555
- font-size: 10px !important;
623
+ font-size: 0.694em !important;
556
624
  letter-spacing: 1px;
557
625
  margin: 0 !important;
558
626
  padding: 0 0 12px !important;
@@ -590,7 +658,7 @@ span.rorvswild-local-panel__details__section__kind {
590
658
  .rorvswild-local-panel__card dt {
591
659
  color: rgb(146 149 159) !important;
592
660
  text-transform: uppercase;
593
- font-size: 10px !important;
661
+ font-size: 0.694em !important;
594
662
  letter-spacing: 1px;
595
663
  }
596
664
 
@@ -609,12 +677,14 @@ span.rorvswild-local-panel__details__section__kind {
609
677
  border: 1px solid rgb(72 75 80) !important;
610
678
  box-shadow: none !important;
611
679
  padding: 0px 8px !important;
612
- font-size: 10px !important;
680
+ font-size: 0.694em !important;
613
681
  line-height: 24px !important;
614
682
  text-transform: uppercase !important;
615
683
  letter-spacing: 1px !important;
616
684
  cursor: pointer !important;
617
685
  font-weight: 700 !important;
686
+ min-height: 24px !important;
687
+ height: 24px !important;
618
688
  transition: all 0.2s !important;
619
689
  }
620
690
 
@@ -640,6 +710,7 @@ a.rorvswild-local-panel__footer__link {
640
710
  }
641
711
 
642
712
  @media screen and (min-width: 720px) {
713
+ .rorvswild-local-panel { font-size: 15px !important; }
643
714
  .rorvswild-local-panel__details__section__main { flex-wrap: nowrap !important; }
644
715
 
645
716
  .rorvswild-local-panel__name,
@@ -14,7 +14,7 @@ http://prismjs.com/download.html?themes=prism-twilight&languages=markup+css+clik
14
14
  text-shadow: 0 0 0 !important;
15
15
  word-spacing: normal !important;
16
16
 
17
- font-size: 14px !important;
17
+ font-size: inherit !important;
18
18
  line-height: 24px !important;
19
19
  font-weight: 300 !important;
20
20
 
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RorVsWild
4
+ module Plugin
5
+ class ViewComponent
6
+ @installed = false
7
+
8
+ def self.setup(agent)
9
+ return if @installed
10
+ return if !defined?(::ViewComponent)
11
+ return if !defined?(ActiveSupport::Notifications.subscribe)
12
+ ActiveSupport::Notifications.subscribe("render.view_component", plugin = new)
13
+ ActiveSupport::Notifications.subscribe("!render.view_component", plugin) # Before 3.4.0 (231d4bb72ce5df334fca6f3be4ed33e887bd2cc8)
14
+ @installed = true
15
+ end
16
+
17
+ def start(name, id, payload)
18
+ return if !payload[:identifier]
19
+ RorVsWild::Section.start
20
+ end
21
+
22
+ def finish(name, id, payload)
23
+ return if !payload[:identifier]
24
+ RorVsWild::Section.stop do |section|
25
+ section.kind = "view"
26
+ section.commands << payload[:name]
27
+ section.file = RorVsWild.agent.locator.relative_path(payload[:identifier])
28
+ section.line = 0
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RorVsWild
4
- VERSION = "1.11.1"
4
+ VERSION = "1.12.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rorvswild
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.1
4
+ version: 1.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexis Bernard
@@ -22,6 +22,8 @@ files:
22
22
  - LICENSE.txt
23
23
  - README.md
24
24
  - bin/rorvswild-install
25
+ - bin/test
26
+ - bin/test-matrix
25
27
  - cacert.pem
26
28
  - lib/rorvswild.rb
27
29
  - lib/rorvswild/agent.rb
@@ -64,6 +66,7 @@ files:
64
66
  - lib/rorvswild/plugin/redis.rb
65
67
  - lib/rorvswild/plugin/resque.rb
66
68
  - lib/rorvswild/plugin/sidekiq.rb
69
+ - lib/rorvswild/plugin/view_component.rb
67
70
  - lib/rorvswild/plugins.rb
68
71
  - lib/rorvswild/queue.rb
69
72
  - lib/rorvswild/rails_loader.rb
@@ -89,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
92
  - !ruby/object:Gem::Version
90
93
  version: '0'
91
94
  requirements: []
92
- rubygems_version: 4.0.3
95
+ rubygems_version: 4.0.10
93
96
  specification_version: 4
94
97
  summary: Ruby on Rails applications monitoring
95
98
  test_files: []