debugbar 0.2.2 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +35 -0
- data/app/controllers/debugbar/polling_controller.rb +1 -1
- data/app/helpers/debugbar/tag_helpers.rb +29 -7
- data/lib/debugbar/subscribers/active_job.rb +13 -3
- data/lib/debugbar/version.rb +1 -1
- data/public/debugbar.js +14 -14
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9533b2b578ca8071254a691d573f41708598945ab8ee666d45655f65f6b30730
|
4
|
+
data.tar.gz: 4aba711679f6a65212f6fa88d543108e64c9a33f3fd99c59a3566d032f67e26b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92d5d50ff82b3087cd332133e5c87733a7b2dc4eaa46c65fe4f5cac909d064a4a1c65612650a1eb10b18350272c8ae3f205663571793635c64a59369cb8aa545
|
7
|
+
data.tar.gz: fd282177ec09843ab1a90ab9a71bb0838225e9958e2d443175faa3f60b8c5b87f7f78ca11bf8a867f671d906d045a0f87508ccc2c777e126f965fdd00161a3d2
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,40 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v0.3.1 - 2024-05-01
|
4
|
+
|
5
|
+
* Add `active_record.adapter` config to help frontend format SQL queries - See [#35](https://github.com/julienbourdeau/debugbar/pull/35)
|
6
|
+
* Add `minimized` config key to start the debugbar minimized - See [2046b054](https://github.com/julienbourdeau/debugbar/commit/0178443d268d2a740a0d73b4039a03dd)
|
7
|
+
* Use `:null_session` to disable forgery protection when using polling - See [#27](https://github.com/julienbourdeau/debugbar/pull/27)
|
8
|
+
|
9
|
+
## v0.3.0 - 2024-03-31
|
10
|
+
|
11
|
+
* Add support for Turbo Drive - See [#25](https://github.com/julienbourdeau/debugbar/pull/25) and [#26](https://github.com/julienbourdeau/debugbar/pull/26)
|
12
|
+
* Fix error "undefined method `adapter_name' for ActiveJob:Module" for Rails < 7.1 - See [#24](https://github.com/julienbourdeau/debugbar/pull/24)
|
13
|
+
* Limit the number of request to 25, configurable with `maxRequests` option - See [664f2c11](https://github.com/julienbourdeau/debugbar/commit/664f2c11e56f18a7c3e4a9fb83ba5b7e19fbb9a9)
|
14
|
+
|
15
|
+
### Breaking changes
|
16
|
+
|
17
|
+
In order to support Turbo Drive, I had to split the helper into two parts. Before the JavaScript file was loaded,
|
18
|
+
directly in the body, but it has to be loaded in the head now.
|
19
|
+
|
20
|
+
If you were passing configuation t `debugbar_javascript`, you must now pass it to `debugbar_body`.
|
21
|
+
|
22
|
+
```diff
|
23
|
+
<!DOCTYPE html>
|
24
|
+
<html>
|
25
|
+
<head>
|
26
|
+
...
|
27
|
+
+ <%= debugbar_head %>
|
28
|
+
</head>
|
29
|
+
|
30
|
+
<body>
|
31
|
+
...
|
32
|
+
- <%= debugbar_javascript %>
|
33
|
+
+ <%= debugbar_body %>
|
34
|
+
</body>
|
35
|
+
</html>
|
36
|
+
```
|
37
|
+
|
3
38
|
## v0.2.0 - 2024-02-28
|
4
39
|
|
5
40
|
* 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
|
@@ -7,20 +13,36 @@ module Debugbar::TagHelpers
|
|
7
13
|
opt[:mode] = 'poll'
|
8
14
|
end
|
9
15
|
|
16
|
+
if opt[:active_record].nil?
|
17
|
+
opt[:active_record] = { adapter: db_adapter }
|
18
|
+
end
|
19
|
+
|
10
20
|
html = <<-HTML
|
11
|
-
<div id="__debugbar"></div>
|
21
|
+
<div id="__debugbar" data-turbo-permanent></div>
|
12
22
|
HTML
|
13
23
|
|
14
24
|
html += <<-HTML
|
15
|
-
<script type="text/javascript">
|
25
|
+
<script type="text/javascript" data-turbo-permanent>
|
16
26
|
window._debugbarConfigOptions = #{opt.to_json}
|
17
27
|
</script>
|
18
28
|
HTML
|
19
29
|
|
20
|
-
html += <<-HTML
|
21
|
-
<script defer src="#{Debugbar.config.prefix}/assets/script"></script>
|
22
|
-
HTML
|
23
|
-
|
24
30
|
raw html
|
25
31
|
end
|
32
|
+
|
33
|
+
def debugbar_javascript(opt = {})
|
34
|
+
errors = [""]
|
35
|
+
errors << "debugbar_javascript was removed in 0.3.0."
|
36
|
+
errors << "Please use `debugbar_head` inside <head> and `debugbar_body` at the end of <body> instead."
|
37
|
+
errors << "It was split to support Turbo Drive."
|
38
|
+
errors << "See https://debugbar.dev/changelog/ for more information."
|
39
|
+
errors << ""
|
40
|
+
raise errors.join("\n")
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def db_adapter
|
46
|
+
ActiveRecord::Base.connection.adapter_name.downcase
|
47
|
+
end
|
26
48
|
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