debugbar 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/app/helpers/debugbar/tag_helpers.rb +19 -7
- data/config/routes.rb +3 -1
- data/lib/debugbar/middlewares/track_current_request.rb +2 -1
- data/lib/debugbar/subscribers/active_job.rb +13 -3
- data/lib/debugbar/version.rb +1 -1
- data/public/debugbar.js +14 -14
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21eb9bf1086b2890a2b6d0ecdcc04e901ef902b5de0593630320ee107ab8ea2a
|
4
|
+
data.tar.gz: 94e7e6f98f27b86ff2f28bbc915b20086ac5350b349c138d796fe051323141a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c352157d378dae219d2a84f2482ebb102f552891af731f44d44357514cee04b5fd2d83ad766e21b5dfd5b9d7abe47b16250ea964e19c7fe1b89e85e005fa7bcd
|
7
|
+
data.tar.gz: 5be2a2ff6dd67a5aa27d7daf00cebd0cc161d956235192b1f4a10691e6437fd5828006d996ea11627e6eb56e5da4354c3ea4fb95a7de3f88c24abb0c9ea1e095
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v0.3.0 - 2024-03-31
|
4
|
+
|
5
|
+
* Add support for Turbo Drive - See [#25](https://github.com/julienbourdeau/debugbar/pull/25) and [#26](https://github.com/julienbourdeau/debugbar/pull/26)
|
6
|
+
* Fix error "undefined method `adapter_name' for ActiveJob:Module" for Rails < 7.1 - See [#24](https://github.com/julienbourdeau/debugbar/pull/24)
|
7
|
+
* Limit the number of request to 25, configurable with `maxRequests` option - See [664f2c11](https://github.com/julienbourdeau/debugbar/commit/664f2c11e56f18a7c3e4a9fb83ba5b7e19fbb9a9)
|
8
|
+
|
3
9
|
## v0.2.0 - 2024-02-28
|
4
10
|
|
5
11
|
* Introduce polling in case someone cannot use ActiveCable - See [8b262be7](https://github.com/julienbourdeau/debugbar/commit/8b262be7b644c7b587a6c3348bb02076053a344f)
|
@@ -1,5 +1,11 @@
|
|
1
1
|
module Debugbar::TagHelpers
|
2
|
-
def
|
2
|
+
def debugbar_head
|
3
|
+
raw <<-HTML
|
4
|
+
<script defer src="#{Debugbar.config.prefix}/assets/script"></script>
|
5
|
+
HTML
|
6
|
+
end
|
7
|
+
|
8
|
+
def debugbar_body(opt = {})
|
3
9
|
opt = ActiveSupport::HashWithIndifferentAccess.new(opt)
|
4
10
|
|
5
11
|
# See https://github.com/julienbourdeau/debugbar/issues/8
|
@@ -8,19 +14,25 @@ module Debugbar::TagHelpers
|
|
8
14
|
end
|
9
15
|
|
10
16
|
html = <<-HTML
|
11
|
-
<div id="__debugbar"></div>
|
17
|
+
<div id="__debugbar" data-turbo-permanent></div>
|
12
18
|
HTML
|
13
19
|
|
14
20
|
html += <<-HTML
|
15
|
-
<script type="text/javascript">
|
21
|
+
<script type="text/javascript" data-turbo-permanent>
|
16
22
|
window._debugbarConfigOptions = #{opt.to_json}
|
17
23
|
</script>
|
18
24
|
HTML
|
19
25
|
|
20
|
-
html += <<-HTML
|
21
|
-
<script defer src="#{Debugbar.config.prefix}/assets/script"></script>
|
22
|
-
HTML
|
23
|
-
|
24
26
|
raw html
|
25
27
|
end
|
28
|
+
|
29
|
+
def debugbar_javascript(opt = {})
|
30
|
+
errors = [""]
|
31
|
+
errors << "debugbar_javascript was removed in 0.3.0."
|
32
|
+
errors << "Please use `debugbar_head` inside <head> and `debugbar_body` at the end of <body> instead."
|
33
|
+
errors << "It was split to support Turbo Drive."
|
34
|
+
errors << "See https://debugbar.dev/changelog/ for more information."
|
35
|
+
errors << ""
|
36
|
+
raise errors.join("\n")
|
37
|
+
end
|
26
38
|
end
|
data/config/routes.rb
CHANGED
@@ -25,7 +25,8 @@ module Debugbar
|
|
25
25
|
|
26
26
|
RequestBuffer.push(Debugbar::Current.pop_request!)
|
27
27
|
|
28
|
-
|
28
|
+
# TODO: Refactor has not having ActionCable might more common than I thought
|
29
|
+
if Debugbar.connected? && defined?(ActionCable)
|
29
30
|
data = RequestBuffer.all.map(&:to_h)
|
30
31
|
ActionCable.server.broadcast("debugbar_channel", data)
|
31
32
|
end
|
@@ -82,15 +82,25 @@ module Debugbar
|
|
82
82
|
# else
|
83
83
|
# failed_enqueue_count = jobs.size - enqueued_count
|
84
84
|
# "Failed enqueuing #{failed_enqueue_count} #{'job'.pluralize(failed_enqueue_count)} "\
|
85
|
-
# "to #{
|
85
|
+
# "to #{adapter_name(adapter)}"
|
86
86
|
# end
|
87
87
|
# end
|
88
88
|
# end
|
89
89
|
# # subscribe_log_level :enqueue_all, :info
|
90
90
|
|
91
91
|
private
|
92
|
+
|
93
|
+
# See ActiveJob.adapter_name for orignal implementation. This is redefined here
|
94
|
+
# to be compatible with the older Rails version.
|
95
|
+
def adapter_name(adapter) # :nodoc:
|
96
|
+
return adapter.queue_adapter_name if adapter.respond_to?(:queue_adapter_name)
|
97
|
+
|
98
|
+
adapter_class = adapter.is_a?(Module) ? adapter : adapter.class
|
99
|
+
"#{adapter_class.name.demodulize.delete_suffix('Adapter')}"
|
100
|
+
end
|
101
|
+
|
92
102
|
def queue_name(event)
|
93
|
-
|
103
|
+
adapter_name(event.payload[:adapter]) + "(#{event.payload[:job].queue_name})"
|
94
104
|
end
|
95
105
|
|
96
106
|
def args_info(job)
|
@@ -150,7 +160,7 @@ module Debugbar
|
|
150
160
|
def enqueued_jobs_message(adapter, enqueued_jobs)
|
151
161
|
enqueued_count = enqueued_jobs.size
|
152
162
|
job_classes_counts = enqueued_jobs.map(&:class).tally.sort_by { |_k, v| -v }
|
153
|
-
"Enqueued #{enqueued_count} #{'job'.pluralize(enqueued_count)} to #{
|
163
|
+
"Enqueued #{enqueued_count} #{'job'.pluralize(enqueued_count)} to #{adapter_name(adapter)}"\
|
154
164
|
" (#{job_classes_counts.map { |klass, count| "#{count} #{klass}" }.join(', ')})"
|
155
165
|
end
|
156
166
|
end
|
data/lib/debugbar/version.rb
CHANGED