rails_mini_profiler 0 → 0.1.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.
Files changed (134) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +29 -111
  3. data/Rakefile +18 -0
  4. data/app/{javascript/images → assets/images/rails_mini_profiler}/bookmark.svg +0 -0
  5. data/app/{javascript/images → assets/images/rails_mini_profiler}/chart.svg +0 -0
  6. data/app/{javascript/images → assets/images/rails_mini_profiler}/delete.svg +0 -0
  7. data/app/{javascript/images → assets/images/rails_mini_profiler}/graph.svg +0 -0
  8. data/app/{javascript/images → assets/images/rails_mini_profiler}/logo.svg +0 -0
  9. data/app/{javascript/images → assets/images/rails_mini_profiler}/logo_variant.svg +2 -2
  10. data/app/assets/images/rails_mini_profiler/search.svg +10 -0
  11. data/app/{javascript/images → assets/images/rails_mini_profiler}/setting.svg +0 -0
  12. data/app/{javascript/images → assets/images/rails_mini_profiler}/show.svg +0 -0
  13. data/app/assets/javascripts/rails_mini_profiler.js +76 -1
  14. data/app/assets/stylesheets/rails_mini_profiler/application.css +149 -1
  15. data/app/assets/stylesheets/rails_mini_profiler/flamegraph.css +14 -0
  16. data/app/{javascript/stylesheets/flashes.scss → assets/stylesheets/rails_mini_profiler/flashes.css} +5 -3
  17. data/app/{javascript/stylesheets/navbar.scss → assets/stylesheets/rails_mini_profiler/navbar.css} +14 -8
  18. data/app/assets/stylesheets/rails_mini_profiler/profiled_requests.css +180 -0
  19. data/app/{javascript/stylesheets/traces.scss → assets/stylesheets/rails_mini_profiler/traces.css} +22 -17
  20. data/app/controllers/rails_mini_profiler/application_controller.rb +4 -9
  21. data/app/controllers/rails_mini_profiler/profiled_requests_controller.rb +10 -23
  22. data/app/helpers/rails_mini_profiler/application_helper.rb +0 -11
  23. data/app/models/rails_mini_profiler/application_record.rb +1 -1
  24. data/app/models/rails_mini_profiler/controller_trace.rb +3 -7
  25. data/app/models/rails_mini_profiler/flamegraph.rb +0 -4
  26. data/app/models/rails_mini_profiler/instantiation_trace.rb +3 -7
  27. data/app/models/rails_mini_profiler/profiled_request.rb +15 -21
  28. data/app/models/rails_mini_profiler/render_partial_trace.rb +3 -7
  29. data/app/models/rails_mini_profiler/render_template_trace.rb +3 -7
  30. data/app/models/rails_mini_profiler/rmp_trace.rb +3 -7
  31. data/app/models/rails_mini_profiler/sequel_trace.rb +3 -7
  32. data/app/models/rails_mini_profiler/trace.rb +3 -7
  33. data/app/presenters/rails_mini_profiler/profiled_request_presenter.rb +15 -8
  34. data/app/views/layouts/rails_mini_profiler/application.html.erb +12 -1
  35. data/app/views/layouts/rails_mini_profiler/flamegraph.html.erb +8 -1
  36. data/app/views/rails_mini_profiler/badge.html.erb +2 -2
  37. data/app/views/rails_mini_profiler/profiled_requests/index.html.erb +58 -8
  38. data/app/views/rails_mini_profiler/profiled_requests/show.html.erb +1 -1
  39. data/app/views/rails_mini_profiler/shared/_navbar.html.erb +1 -1
  40. data/db/migrate/20210621185018_create_rmp.rb +6 -8
  41. data/lib/generators/rails_mini_profiler/install_generator.rb +0 -24
  42. data/lib/generators/rails_mini_profiler/templates/rails_mini_profiler.rb.erb +7 -23
  43. data/lib/rails_mini_profiler/badge.rb +1 -23
  44. data/lib/rails_mini_profiler/configuration.rb +4 -28
  45. data/lib/rails_mini_profiler/engine.rb +4 -15
  46. data/lib/rails_mini_profiler/errors.rb +8 -0
  47. data/lib/rails_mini_profiler/guard.rb +7 -18
  48. data/lib/rails_mini_profiler/logger.rb +0 -5
  49. data/lib/rails_mini_profiler/middleware.rb +4 -4
  50. data/lib/rails_mini_profiler/models/base_model.rb +0 -5
  51. data/lib/rails_mini_profiler/models/trace.rb +9 -0
  52. data/lib/rails_mini_profiler/redirect.rb +1 -9
  53. data/lib/rails_mini_profiler/request_context.rb +7 -31
  54. data/lib/rails_mini_profiler/request_wrapper.rb +8 -44
  55. data/lib/rails_mini_profiler/storage.rb +29 -0
  56. data/lib/rails_mini_profiler/tracers.rb +85 -0
  57. data/lib/rails_mini_profiler/version.rb +1 -1
  58. data/lib/rails_mini_profiler.rb +9 -33
  59. metadata +30 -127
  60. data/LICENSE +0 -20
  61. data/app/javascript/images/check.svg +0 -3
  62. data/app/javascript/images/chevron.svg +0 -3
  63. data/app/javascript/images/filter.svg +0 -1
  64. data/app/javascript/images/search.svg +0 -9
  65. data/app/javascript/js/checklist_controller.js +0 -48
  66. data/app/javascript/js/enable_controller.js +0 -24
  67. data/app/javascript/js/filter_controller.js +0 -44
  68. data/app/javascript/js/search_controller.js +0 -18
  69. data/app/javascript/js/select_controller.js +0 -47
  70. data/app/javascript/packs/rails-mini-profiler.js +0 -88
  71. data/app/javascript/stylesheets/components/page_header/page_header.scss +0 -3
  72. data/app/javascript/stylesheets/components/pagination.scss +0 -55
  73. data/app/javascript/stylesheets/components/profiled_request_table/placeholder.scss +0 -33
  74. data/app/javascript/stylesheets/components/profiled_request_table/profiled_request_table.scss +0 -179
  75. data/app/javascript/stylesheets/flamegraph.scss +0 -10
  76. data/app/javascript/stylesheets/profiled_requests.scss +0 -89
  77. data/app/javascript/stylesheets/rails-mini-profiler.scss +0 -205
  78. data/app/search/rails_mini_profiler/base_search.rb +0 -67
  79. data/app/search/rails_mini_profiler/profiled_request_search.rb +0 -34
  80. data/app/views/models/_flamegraph.json.jb +0 -3
  81. data/app/views/models/_profiled_request.jb +0 -3
  82. data/app/views/models/_trace.jb +0 -3
  83. data/app/views/rails_mini_profiler/flamegraphs/show.json.jb +0 -3
  84. data/app/views/rails_mini_profiler/profiled_requests/index.json.jb +0 -3
  85. data/app/views/rails_mini_profiler/profiled_requests/shared/header/_header.erb +0 -20
  86. data/app/views/rails_mini_profiler/profiled_requests/shared/table/_placeholder.erb +0 -12
  87. data/app/views/rails_mini_profiler/profiled_requests/shared/table/_table.erb +0 -14
  88. data/app/views/rails_mini_profiler/profiled_requests/shared/table/_table_head.erb +0 -125
  89. data/app/views/rails_mini_profiler/profiled_requests/shared/table/_table_row.erb +0 -21
  90. data/app/views/rails_mini_profiler/profiled_requests/show.json.jb +0 -5
  91. data/app/views/rails_mini_profiler/shared/_head.erb +0 -13
  92. data/lib/generators/rails_mini_profiler/templates/rails_mini_profiler.js.erb +0 -13
  93. data/lib/rails_mini_profiler/configuration/storage.rb +0 -47
  94. data/lib/rails_mini_profiler/configuration/user_interface.rb +0 -48
  95. data/lib/rails_mini_profiler/tracing/controller_tracer.rb +0 -15
  96. data/lib/rails_mini_profiler/tracing/null_trace.rb +0 -7
  97. data/lib/rails_mini_profiler/tracing/sequel_tracer.rb +0 -37
  98. data/lib/rails_mini_profiler/tracing/sequel_tracker.rb +0 -37
  99. data/lib/rails_mini_profiler/tracing/subscriptions.rb +0 -34
  100. data/lib/rails_mini_profiler/tracing/trace.rb +0 -45
  101. data/lib/rails_mini_profiler/tracing/trace_factory.rb +0 -37
  102. data/lib/rails_mini_profiler/tracing/tracer.rb +0 -31
  103. data/lib/rails_mini_profiler/tracing/view_tracer.rb +0 -12
  104. data/lib/rails_mini_profiler/tracing.rb +0 -11
  105. data/public/rails_mini_profiler/speedscope/LICENSE +0 -21
  106. data/public/rails_mini_profiler/speedscope/demangle-cpp.1768f4cc.js +0 -4
  107. data/public/rails_mini_profiler/speedscope/demangle-cpp.1768f4cc.js.map +0 -1
  108. data/public/rails_mini_profiler/speedscope/favicon-16x16.f74b3187.png +0 -0
  109. data/public/rails_mini_profiler/speedscope/favicon-32x32.bc503437.png +0 -0
  110. data/public/rails_mini_profiler/speedscope/file-format-schema.json +0 -324
  111. data/public/rails_mini_profiler/speedscope/import.e3a73ef4.js +0 -117
  112. data/public/rails_mini_profiler/speedscope/import.e3a73ef4.js.map +0 -1
  113. data/public/rails_mini_profiler/speedscope/index.html +0 -2
  114. data/public/rails_mini_profiler/speedscope/release.txt +0 -3
  115. data/public/rails_mini_profiler/speedscope/reset.8c46b7a1.css +0 -2
  116. data/public/rails_mini_profiler/speedscope/reset.8c46b7a1.css.map +0 -1
  117. data/public/rails_mini_profiler/speedscope/source-map.438fa06b.js +0 -24
  118. data/public/rails_mini_profiler/speedscope/source-map.438fa06b.js.map +0 -1
  119. data/public/rails_mini_profiler/speedscope/speedscope.026f36b0.js +0 -200
  120. data/public/rails_mini_profiler/speedscope/speedscope.026f36b0.js.map +0 -1
  121. data/vendor/assets/images/bookmark.svg +0 -10
  122. data/vendor/assets/images/chart.svg +0 -12
  123. data/vendor/assets/images/check.svg +0 -3
  124. data/vendor/assets/images/chevron.svg +0 -3
  125. data/vendor/assets/images/delete.svg +0 -9
  126. data/vendor/assets/images/filter.svg +0 -1
  127. data/vendor/assets/images/graph.svg +0 -11
  128. data/vendor/assets/images/logo.svg +0 -18
  129. data/vendor/assets/images/logo_variant.svg +0 -32
  130. data/vendor/assets/images/search.svg +0 -9
  131. data/vendor/assets/images/setting.svg +0 -10
  132. data/vendor/assets/images/show.svg +0 -11
  133. data/vendor/assets/javascripts/rails-mini-profiler.css +0 -1
  134. data/vendor/assets/javascripts/rails-mini-profiler.js +0 -1
@@ -1,205 +0,0 @@
1
- @import 'flashes';
2
- @import 'flamegraph';
3
- @import 'navbar';
4
- @import 'profiled_requests';
5
- @import 'traces';
6
- @import 'components/pagination';
7
- @import 'components/page_header/page_header';
8
- @import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700&display=swap');
9
-
10
- @font-face {
11
- font-family: 'Open Sans';
12
- font-style: normal;
13
- font-weight: 400;
14
- }
15
-
16
- @font-face {
17
- font-family: 'Open Sans';
18
- font-style: normal;
19
- font-weight: 600;
20
- }
21
-
22
- @font-face {
23
- font-family: 'Open Sans';
24
- font-style: normal;
25
- font-weight: 700;
26
- }
27
-
28
- html {
29
- width: 100%;
30
- height: 100%;
31
- padding: 0;
32
- margin: 0;
33
- font-family: 'Open Sans', monospace;
34
-
35
- --grey-50: #f9fafb;
36
- --grey-100: #f3f4f6;
37
- --grey-200: #e5e7eb;
38
- --grey-400: #9ca3af;
39
- --grey-500: #6b7280;
40
- --grey-700: #374151;
41
- --grey-900: #111827;
42
- --red-400: #f87171;
43
- --red-500: #ef4444;
44
- --red-600: #dc2626;
45
- --yellow-400: #fbbf24;
46
- --yellow-500: #fbbf24;
47
- --yellow-600: #d97706;
48
- --yellow-700: #b45309;
49
- --green-300: #6ee7b7;
50
- --green-400: #34d399;
51
- --green-500: #10b981;
52
- --blue-400: #60a5fa;
53
- --blue-500: #3b82f6;
54
- --main-width: 1056px;
55
- --primary: var(--red-600);
56
- --border-color: var(--grey-200);
57
- --text-color: var(--grey-900);
58
- }
59
-
60
- * {
61
- padding: 0;
62
- margin: 0;
63
- }
64
-
65
- body {
66
- width: 100%;
67
- height: 100%;
68
- padding: 0;
69
- margin: 0;
70
- color: var(--text-color);
71
- }
72
-
73
- button,
74
- .button {
75
- display: inline-block;
76
- padding: 0.5em 0.5em;
77
- border: none;
78
- border-radius: 0.25rem;
79
- cursor: pointer;
80
- font-size: 1rem;
81
- text-align: center;
82
- text-decoration: none;
83
-
84
- &:disabled {
85
- background: var(--grey-200);
86
- cursor: not-allowed;
87
- }
88
- }
89
-
90
- button:hover {
91
- box-shadow: 0 0.25rem 0.25rem 0 var(--grey-50);
92
- }
93
-
94
- button.none {
95
- padding: 0;
96
- border: none;
97
- background: none;
98
- outline: none;
99
-
100
- &:hover {
101
- box-shadow: none;
102
- }
103
- }
104
-
105
- /* --------------------------------------- */
106
-
107
- .text-center {
108
- text-align: center;
109
- }
110
-
111
- .text-left {
112
- text-align: left;
113
- }
114
-
115
- .text-right {
116
- text-align: right;
117
- }
118
-
119
- .hidden {
120
- display: none;
121
- }
122
-
123
- .flex-row {
124
- display: flex;
125
- flex-direction: row;
126
- }
127
-
128
- .flex-column {
129
- display: flex;
130
- flex-direction: column;
131
- }
132
-
133
- /* --------------------------------------- */
134
-
135
- .pill {
136
- padding: 0.1rem 0.4rem;
137
- margin: 0.2rem 0;
138
- background: var(--grey-200);
139
- border-radius: 5px;
140
- font-size: 0.9rem;
141
- font-weight: 600;
142
- letter-spacing: 0.1rem;
143
- }
144
-
145
- /* --------------------------------------- */
146
-
147
- .popover {
148
- display: flex;
149
- width: 600px;
150
- flex-direction: column;
151
- padding: 1em;
152
- color: black;
153
- }
154
-
155
- .popover-header {
156
- display: flex;
157
- flex-direction: row;
158
- align-items: center;
159
- justify-content: space-between;
160
- padding-bottom: 1em;
161
- }
162
-
163
- .popover-description {
164
- padding: 0;
165
- margin: 0;
166
- }
167
-
168
- .popover-close {
169
- padding: 0;
170
- background: transparent;
171
- color: var(--grey-400);
172
- font-size: 20px;
173
- font-weight: 700;
174
- }
175
-
176
- .popover-body {
177
- padding: 1em 0;
178
- }
179
-
180
- .popover-footer {
181
- border-top: 1px solid var(--grey-50);
182
- }
183
-
184
- .tippy-box[data-theme~='rmp'] {
185
- background: white;
186
- border-radius: 5px;
187
- box-shadow: 8px 0 30px 4px rgba(0, 0, 0, 0.2), 8px 4px 10px 0 rgba(0, 0, 0, 0.05);
188
- transition: all cubic-bezier(0.19, 1, 0.22, 1) 0.2s;
189
- }
190
-
191
- .tippy-box[data-theme~='rmp'][data-placement^='top'] > .tippy-arrow::before {
192
- border-top-color: white;
193
- }
194
-
195
- .tippy-box[data-theme~='rmp'][data-placement^='bottom'] > .tippy-arrow::before {
196
- border-bottom-color: white;
197
- }
198
-
199
- .tippy-box[data-theme~='rmp'][data-placement^='left'] > .tippy-arrow::before {
200
- border-left-color: white;
201
- }
202
-
203
- .tippy-box[data-theme~='rmp'][data-placement^='right'] > .tippy-arrow::before {
204
- border-right-color: white;
205
- }
@@ -1,67 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RailsMiniProfiler
4
- class BaseSearch
5
- def initialize(params = nil, **kwargs)
6
- config = self.class.config
7
- options = params&.to_h || {}
8
- options = options.merge(kwargs)
9
- @scope = options.delete(:scope) || (config[:scope] && instance_eval(&config[:scope]))
10
- @options = (options.delete(:options) || config[:options]).stringify_keys
11
- @params = options.stringify_keys.slice(*@options.keys)
12
- end
13
-
14
- def results
15
- @results ||= apply
16
- end
17
-
18
- def results?
19
- results.any?
20
- end
21
-
22
- class << self
23
- def scope(&block)
24
- config[:scope] = block
25
- end
26
-
27
- def option(name, options = {}, &block)
28
- name = name.to_s
29
- handler = options[:with] || block
30
-
31
- config[:options][name] = normalize_search_handler(handler, name)
32
-
33
- define_method(name) { @search.param name }
34
- end
35
-
36
- def results(**kwargs)
37
- new(**kwargs).results
38
- end
39
-
40
- def config
41
- @config ||= { options: {} }
42
- end
43
-
44
- private
45
-
46
- def normalize_search_handler(handler, name)
47
- case handler
48
- when Symbol
49
- ->(scope, value) { method(handler).call scope, value }
50
- when Proc
51
- handler
52
- else
53
- ->(scope, value) { scope.where name => value unless value.blank? }
54
- end
55
- end
56
- end
57
-
58
- private
59
-
60
- def apply
61
- @params.inject(@scope) do |scope, (name, value)|
62
- new_scope = instance_exec scope, value, &@options[name]
63
- new_scope || scope
64
- end
65
- end
66
- end
67
- end
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RailsMiniProfiler
4
- class ProfiledRequestSearch < BaseSearch
5
- option(:id) do |scope, value|
6
- scope.where(id: value)
7
- end
8
-
9
- option(:path) do |scope, value|
10
- scope.where('request_path LIKE ?', "%#{value}%")
11
- end
12
-
13
- option(:method) do |scope, value|
14
- scope.where(request_method: value)
15
- end
16
-
17
- option(:media_type) do |scope, value|
18
- scope.where(response_media_type: value)
19
- end
20
-
21
- option(:status) do |scope, value|
22
- value = value.map(&:to_i)
23
- min = value.min
24
- max = value.max + 100
25
- scope.where('response_status >= :lower', lower: min)
26
- .where('response_status < :upper', upper: max)
27
- end
28
-
29
- option(:duration) do |scope, value|
30
- value = value.tr('>', '').to_i * 100
31
- scope.where('duration > :duration', duration: value)
32
- end
33
- end
34
- end
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- flamegraph
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- profiled_request.attributes
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- trace.attributes
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- render 'models/flamegraph', flamegraph: @flamegraph
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- render partial: 'models/profiled_request', collection: @profiled_requests, as: :profiled_request
@@ -1,20 +0,0 @@
1
- <div class="page-header profiled-requests-header">
2
- <div class="">
3
- <h1>Profiled Requests</h1>
4
- </div>
5
- <div>
6
- <%= button_tag('Delete Selected',
7
- disabled: params[:id].blank?,
8
- data: {
9
- controller: 'enable',
10
- 'enable-target': 'enable',
11
- action: 'rmp:select:change@window->enable#change click->filters#post'
12
- }) -%>
13
- <%= link_to(destroy_all_profiled_requests_url,
14
- method: :delete,
15
- class: 'clear-action',
16
- data: { confirm: "This will delete all requests. Are you sure?" }) do %>
17
- <%= button_tag('Delete All') %>
18
- <% end %>
19
- </div>
20
- </div>
@@ -1,12 +0,0 @@
1
- <tr class="no-row">
2
- <td colspan="100%">
3
- <div class="placeholder">
4
- <%= inline_svg('logo_variant.svg', class: 'placeholder-image') %>
5
- <div class="placeholder-text">
6
- <h2>No Requests found!</h2>
7
- <p>Send some requests to your app or modify your filters</p>
8
- </div>
9
- <%= link_to('Clear Filters', profiled_requests_path, class: 'placeholder-link') %>
10
- </div>
11
- </td>
12
- </tr>
@@ -1,14 +0,0 @@
1
- <table
2
- id="profiled-requests-table"
3
- class="table">
4
- <%= render "rails_mini_profiler/profiled_requests/shared/table/table_head" %>
5
- <tbody>
6
- <% if @profiled_requests.empty? %>
7
- <%= render "rails_mini_profiler/profiled_requests/shared/table/placeholder" %>
8
- <% else %>
9
- <% @profiled_requests.each do |profiled_request| %>
10
- <%= render "rails_mini_profiler/profiled_requests/shared/table/table_row", profiled_request: profiled_request %>
11
- <% end %>
12
- <% end %>
13
- </tbody>
14
- </table>
@@ -1,125 +0,0 @@
1
- <thead>
2
- <tr>
3
- <th style="width: 20px;" class="text-left">
4
- <%= label_tag nil do %>
5
- <%= check_box_tag 'selected[]', nil,
6
- params.fetch(:selected, []).size == @pagy.items,
7
- class: "request-checkbox",
8
- data: {
9
- action: 'click->selectable#selectAll',
10
- 'selectable-target': 'all'
11
- }
12
- %>
13
- <% end %>
14
- </th>
15
- <th style="width: 25%;" class="text-left" data-controller="dropdown">
16
- <button data-action="click->dropdown#toggle click@window->dropdown#hide" data-dropdown-target="button" class="dropdown-toggle none">
17
- Path <%= inline_svg('search.svg', class: 'table-filter-icon') %> </button>
18
- <div data-controller="search" data-dropdown-target="menu" class="dropdown-container hidden">
19
- <div class="dropdown-body">
20
- <%= form_with url: profiled_requests_url, method: :get do |form| %>
21
- <%= form.search_field :path,
22
- value: params[:path],
23
- placeholder: 'Search Path',
24
- class: 'dropdown-search-field',
25
- data: { 'filters-target': 'filter' } %>
26
- <%= form.submit 'Search', class: 'dropdown-search-button', data: { action: 'click->search#submit' } -%>
27
- <% end %>
28
- </div>
29
- </div>
30
- </th>
31
- <th style="width: 10%;" class="" data-controller="dropdown">
32
- <button data-action="click->dropdown#toggle click@window->dropdown#hide" data-dropdown-target="button" class="dropdown-toggle none">
33
- Method <%= inline_svg('filter.svg', class: 'table-filter-icon') %> </button>
34
- <div data-controller="checklist" data-dropdown-target="menu" class="dropdown-container hidden">
35
- <div class="dropdown-header">
36
- Select Method...
37
- <button class="clear-filters" data-action="checklist#checkNone">
38
- Clear filter
39
- </button>
40
- </div>
41
- <% %w[get put post delete].map(&:upcase).each do |method| %>
42
- <%= label_tag nil, class: "dropdown-entry" do %>
43
- <%= check_box_tag 'method[]', method, params.fetch(:method, []).include?(method),
44
- class: "",
45
- data: { 'filters-target': "filter" } %>
46
- <%= method %>
47
- <% end %>
48
- <% end %>
49
- <button class="dropdown-footer" data-action="filters#apply">
50
- Apply
51
- </button>
52
- </div>
53
- </th>
54
- <th style="width: 10%;" class="" data-controller="dropdown">
55
- <button data-action="click->dropdown#toggle click@window->dropdown#hide" data-dropdown-target="button" class="dropdown-toggle none">
56
- Status <%= inline_svg('filter.svg', class: 'table-filter-icon') %> </button>
57
- <div data-controller="checklist" data-dropdown-target="menu" class="dropdown-container hidden">
58
- <div class="dropdown-header">
59
- Select Status...
60
- <button class="clear-filters" data-action="checklist#checkNone filters#apply">
61
- Clear filter
62
- </button>
63
- </div>
64
- <% %w[200 300 400 500].each do |status| %>
65
- <%= label_tag nil, class: "dropdown-entry" do %>
66
- <%= check_box_tag 'status[]', status, params.fetch(:status, []).include?(status),
67
- class: "",
68
- data: { 'filters-target': "filter" } %>
69
- <%= status %>
70
- <% end %>
71
- <% end %>
72
- <button class="dropdown-footer" data-action="filters#apply">
73
- Apply
74
- </button>
75
- </div>
76
- </th>
77
- <th style="width: 15%" class="" data-controller="dropdown">
78
- <button data-action="click->dropdown#toggle click@window->dropdown#hide" data-dropdown-target="button" class="dropdown-toggle none">
79
- Media Type <%= inline_svg('filter.svg', class: 'table-filter-icon') %> </button>
80
- <div data-controller="checklist" data-dropdown-target="menu" class="dropdown-container hidden">
81
- <div class="dropdown-header">
82
- Select Media Type...
83
- <button class="clear-filters" data-action="checklist#checkNone filters#apply">
84
- Clear filter
85
- </button>
86
- </div>
87
- <% %w[text/html application/json application/xml].each do |media_type| %>
88
- <%= label_tag nil, class: "dropdown-entry" do %>
89
- <%= check_box_tag 'media_type[]', media_type, params.fetch(:media_type, []).include?(media_type),
90
- class: "",
91
- data: { target: "filters.filter" } %>
92
- <%= media_type %>
93
- <% end %>
94
- <% end %>
95
- <button class="dropdown-footer" data-action="filters#apply">
96
- Apply
97
- </button>
98
- </div>
99
- </th>
100
- <th style="width: 10%" class="text-left" data-controller="dropdown">
101
- <button data-action="click->dropdown#toggle click@window->dropdown#hide" data-dropdown-target="button" class="dropdown-toggle none">
102
- Duration <%= inline_svg('filter.svg', class: 'table-filter-icon') %> </button>
103
- <div data-controller="checklist" data-dropdown-target="menu" class="dropdown-container hidden">
104
- <div class="dropdown-header">
105
- Select Duration...
106
- <button class="clear-filters" data-action="checklist#checkNone filters#apply">
107
- Clear filter
108
- </button>
109
- </div>
110
- <% %w[>100ms >250ms].each do |duration| %>
111
- <%= label_tag nil, class: "dropdown-entry" do %>
112
- <%= radio_button_tag 'duration', duration, params.fetch(:duration, []).include?(duration),
113
- class: "",
114
- data: { target: "filters.filter" } %>
115
- <%= duration %>
116
- <% end %>
117
- <% end %>
118
- <button class="dropdown-footer" data-action="filters#apply">
119
- Apply
120
- </button>
121
- </div>
122
- </th>
123
- <th style="width: 15%" class="text-left">Date</th>
124
- </tr>
125
- </thead>
@@ -1,21 +0,0 @@
1
- <tr data-link="<%= profiled_request_path(profiled_request.id) %>">
2
- <td class="">
3
- <%= label_tag nil do %>
4
- <%= check_box_tag 'id[]', profiled_request.id,
5
- params.fetch(:selected, []).include?(profiled_request.id),
6
- class: "request-checkbox",
7
- data: {
8
- 'selectable-target': 'selectable',
9
- 'filters-target': 'filter',
10
- action: 'click->selectable#onSelected'
11
- },
12
- onclick: "event.stopPropagation();" %>
13
- <% end %>
14
- </td>
15
- <td class="request-path"><%= profiled_request.request_name %></td>
16
- <td class="text-left"> <%= profiled_request.request_method %> </td>
17
- <td class="text-left"> <%= profiled_request.response_status %> </td>
18
- <td class="text-left"> <%= profiled_request.response_media_type %> </td>
19
- <td class="text-left"><%= profiled_request.duration %> ms</td>
20
- <td class="text-left"><%= profiled_request.created_at %></td>
21
- </tr>
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- request = render 'models/profiled_request', profiled_request: @profiled_request
4
- request[:traces] = render partial: 'models/trace', collection: @traces, as: :trace
5
- request
@@ -1,13 +0,0 @@
1
- <head>
2
- <title>Rails Mini Profiler</title>
3
- <%= csrf_meta_tags %>
4
- <%= csp_meta_tag %>
5
-
6
- <% if defined?(Webpacker::Engine) %>
7
- <%= javascript_pack_tag "rails-mini-profiler" %>
8
- <%= stylesheet_pack_tag 'rails-mini-profiler' %>
9
- <% else %>
10
- <%= javascript_include_tag "rails_mini_profiler" %>
11
- <%= stylesheet_link_tag "rails_mini_profiler/application", media: "all" %>
12
- <%end %>
13
- </head>
@@ -1,13 +0,0 @@
1
- import "@rails-mini-profiler/assets"
2
-
3
- // Import styles
4
- import "@rails-mini-profiler/assets/dist/rails-mini-profiler.css";
5
-
6
- // Import images
7
- //
8
- // You may simplify this when using a glob loader (e.g glob-import-loader)
9
- <%- Dir.chdir(RailsMiniProfiler::Engine.root.join('app/javascript/images')) do -%>
10
- <%- Dir.glob('**/*').each do |file| -%>
11
- import "@rails-mini-profiler/assets/dist/images/<%= file %>";
12
- <%- end -%>
13
- <%- end -%>
@@ -1,47 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RailsMiniProfiler
4
- # Configure how profiling data is stored within your Rails app.
5
- #
6
- # @!attribute database
7
- # @return [Symbol] which database to connect to
8
- # @!attribute profiled_requests_table
9
- # @return [Symbol] where to store profiled requests
10
- # @!attribute traces_table
11
- # @return [Symbol] where to store traces
12
- # @!attribute flamegraphs_table
13
- # @return [Symbol] where to store flamegraphs
14
- class Storage
15
- class << self
16
- # Construct a new configuration instance
17
- #
18
- # @return [Storage] a new storage configuration
19
- def configuration
20
- @configuration ||= new
21
- end
22
-
23
- # Configure how profiling data is stored
24
- #
25
- # @yieldreturn [Storage] a new storage configuration object
26
- def configure
27
- yield(configuration)
28
- configuration
29
- end
30
- end
31
-
32
- attr_accessor :database, :profiled_requests_table, :traces_table, :flamegraphs_table
33
-
34
- def initialize(**kwargs)
35
- defaults!
36
- kwargs.each { |key, value| instance_variable_set("@#{key}", value) }
37
- end
38
-
39
- # Reset the configuration to default values
40
- def defaults!
41
- @database = nil
42
- @profiled_requests_table = 'rmp_profiled_requests'
43
- @flamegraphs_table = 'rmp_flamegraphs'
44
- @traces_table = 'rmp_traces'
45
- end
46
- end
47
- end
@@ -1,48 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RailsMiniProfiler
4
- # Configure various aspects about Rails Mini Profilers UI.
5
- #
6
- # @!attribute badge_enabled
7
- # @see Badge
8
- # @return [Boolean] if the badge should be enabled
9
- # @!attribute badge_position
10
- # @see Badge
11
- # @return [String] the position of the interactive HTML badge
12
- # @!attribute page_size
13
- # @return [Integer] how many items to render per page in list views
14
- class UserInterface
15
- class << self
16
- # Construct a new UI configuration instance
17
- #
18
- # @return [UserInterface] a new storage configuration
19
- def configuration
20
- @configuration ||= new
21
- end
22
-
23
- # Configure how profiling data is shown to the user
24
- #
25
- # @yieldreturn [UserInterface] a new UI configuration object
26
- def configure
27
- yield(configuration)
28
- configuration
29
- end
30
- end
31
-
32
- attr_accessor :badge_enabled,
33
- :badge_position,
34
- :page_size
35
-
36
- def initialize(**kwargs)
37
- defaults!
38
- kwargs.each { |key, value| instance_variable_set("@#{key}", value) }
39
- end
40
-
41
- # Reset the configuration to default values
42
- def defaults!
43
- @badge_enabled = true
44
- @badge_position = 'top-left'
45
- @page_size = 25
46
- end
47
- end
48
- end
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RailsMiniProfiler
4
- module Tracing
5
- class ControllerTracer < Tracer
6
- def trace
7
- @event[:payload] = @event[:payload]
8
- .slice(:view_runtime, :db_runtime)
9
- .reject { |_k, v| v.blank? }
10
- .transform_values { |value| value&.round(2) }
11
- super
12
- end
13
- end
14
- end
15
- end