rack-mini-profiler 2.0.1 → 2.0.2
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/CHANGELOG.md +4 -0
- data/README.md +10 -0
- data/lib/html/includes.js +40 -26
- data/lib/html/includes.tmpl +2 -2
- data/lib/html/vendor.js +1 -1
- data/lib/mini_profiler/asset_version.rb +1 -1
- data/lib/mini_profiler/profiler.rb +4 -1
- data/lib/mini_profiler/version.rb +1 -1
- data/rack-mini-profiler.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7fcca7a28de2898e8e320f2f94db5d96eee3128b9be7a48053e472036a6ef95
|
4
|
+
data.tar.gz: 3a21bb993d77ef33baca78135716ab0e44dfbd28eefbb8874bae0b9a715ccb3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b4a31ef4e964fbd76646425d1ff16007c56d77360c6ad1f6923e753cd8830614098867ce06d5a554810564674b654b8868b1cdddc9c815942e25314459b3de4
|
7
|
+
data.tar.gz: fb3a9d99bb23a5e5d7b1518cd122a4240658b6c0c5d0c06f1852ddf472e9761cf9e46db5ce6cdcd92d574ec81ec3789f42aee51fe9ee20d8f587b51059cd55e1
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 2.0.2 - 2020-05-25
|
4
|
+
|
5
|
+
- [FIX] client timings were not showing up when you clicked show trivial
|
6
|
+
|
3
7
|
## 2.0.1 - 2020-03-17
|
4
8
|
|
5
9
|
- [REVERT] Prepend Net::HTTP patch instead of class_eval and aliasing (#429) (technique clashes with New Relic and Skylight agents)
|
data/README.md
CHANGED
@@ -407,6 +407,16 @@ if JSON.const_defined?(:Pure)
|
|
407
407
|
end
|
408
408
|
```
|
409
409
|
|
410
|
+
## Development
|
411
|
+
|
412
|
+
If you want to contribute to this project, that's great, thank you! You can run the following rake task:
|
413
|
+
|
414
|
+
```
|
415
|
+
$ bundle exec rake client_dev
|
416
|
+
```
|
417
|
+
|
418
|
+
which will start a local Sinatra server at `http://localhost:9292` where you'll be able to preview your changes. Refreshing the page should be enough to see any changes you make to files in the `lib/html` directory.
|
419
|
+
|
410
420
|
## Running the Specs
|
411
421
|
|
412
422
|
```
|
data/lib/html/includes.js
CHANGED
@@ -108,18 +108,8 @@ var MiniProfiler = (function() {
|
|
108
108
|
// ie is buggy strip out functions
|
109
109
|
var copy = {
|
110
110
|
navigation: {},
|
111
|
-
timing:
|
111
|
+
timing: clientPerformance.timing.toJSON()
|
112
112
|
};
|
113
|
-
var timing = extend({}, clientPerformance.timing);
|
114
|
-
|
115
|
-
for (p in timing) {
|
116
|
-
if (
|
117
|
-
timing.hasOwnProperty(p) &&
|
118
|
-
!(typeof timing[p] === "function")
|
119
|
-
) {
|
120
|
-
copy.timing[p] = timing[p];
|
121
|
-
}
|
122
|
-
}
|
123
113
|
|
124
114
|
if (clientPerformance.navigation) {
|
125
115
|
copy.navigation.redirectCount =
|
@@ -147,10 +137,13 @@ var MiniProfiler = (function() {
|
|
147
137
|
(function() {
|
148
138
|
var request = new XMLHttpRequest();
|
149
139
|
var url = options.path + "results";
|
150
|
-
var params =
|
151
|
-
|
152
|
-
|
153
|
-
|
140
|
+
var params = {
|
141
|
+
id: id,
|
142
|
+
clientPerformance: clientPerformance,
|
143
|
+
clientProbes: clientProbes,
|
144
|
+
popup: 1
|
145
|
+
};
|
146
|
+
var queryParam = toQueryString(params);
|
154
147
|
request.open("POST", url, true);
|
155
148
|
|
156
149
|
request.onload = function() {
|
@@ -172,24 +165,45 @@ var MiniProfiler = (function() {
|
|
172
165
|
"Content-Type",
|
173
166
|
"application/x-www-form-urlencoded"
|
174
167
|
);
|
175
|
-
request.send(
|
168
|
+
request.send(queryParam);
|
176
169
|
})();
|
177
170
|
}
|
178
171
|
}
|
179
172
|
};
|
180
173
|
|
181
|
-
var
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
174
|
+
var toQueryString = function toQueryString(data, parentKey) {
|
175
|
+
var result = [];
|
176
|
+
for (var key in data) {
|
177
|
+
var val = data[key];
|
178
|
+
var newKey = !parentKey ? key : parentKey + "[" + key + "]";
|
179
|
+
if (
|
180
|
+
typeof val === "object" &&
|
181
|
+
!Array.isArray(val) &&
|
182
|
+
val !== null &&
|
183
|
+
val !== undefined
|
184
|
+
) {
|
185
|
+
result[result.length] = toQueryString(val, newKey);
|
186
|
+
} else {
|
187
|
+
if (Array.isArray(val)) {
|
188
|
+
val.forEach(function(v) {
|
189
|
+
result[result.length] =
|
190
|
+
encodeURIComponent(newKey + "[]") + "=" + encodeURIComponent(v);
|
191
|
+
});
|
192
|
+
} else if (val === null || val === undefined) {
|
193
|
+
result[result.length] = encodeURIComponent(newKey) + "=";
|
194
|
+
} else {
|
195
|
+
result[result.length] =
|
196
|
+
encodeURIComponent(newKey) +
|
197
|
+
"=" +
|
198
|
+
encodeURIComponent(val.toString());
|
199
|
+
}
|
189
200
|
}
|
190
201
|
}
|
191
|
-
|
192
|
-
|
202
|
+
return result
|
203
|
+
.filter(function(element) {
|
204
|
+
return element && element.length > 0;
|
205
|
+
})
|
206
|
+
.join("&");
|
193
207
|
};
|
194
208
|
|
195
209
|
var renderTemplate = function renderTemplate(json) {
|
data/lib/html/includes.tmpl
CHANGED
@@ -128,8 +128,8 @@
|
|
128
128
|
{{? it.custom_link}}
|
129
129
|
<a href="{{= it.custom_link }}" class="profiler-custom-link" target="_blank">{{= it.custom_link_name }}</a>
|
130
130
|
{{?}}
|
131
|
-
{{? it.has_trivial_timings}}
|
132
|
-
<a class="profiler-toggle-trivial" data-show-on-load="{{= it.has_all_trivial_timings }}" title="toggles any rows with < {{= it.trivial_duration_threshold_milliseconds }} ms">
|
131
|
+
{{? it.page.has_trivial_timings}}
|
132
|
+
<a class="profiler-toggle-trivial" data-show-on-load="{{= it.page.has_all_trivial_timings }}" title="toggles any rows with < {{= it.page.trivial_duration_threshold_milliseconds }} ms">
|
133
133
|
show trivial
|
134
134
|
</a>
|
135
135
|
{{?}}
|
data/lib/html/vendor.js
CHANGED
@@ -11,7 +11,7 @@ var out=' |
}
|
|
12
12
|
MiniProfiler.templates["linksTemplate"] = function anonymous(it
|
|
13
13
|
) {
|
|
14
|
-
var out=' <a href="'+( MiniProfiler.shareUrl(it.page.id) )+'" class="profiler-share-profiler-results" target="_blank">share</a> <a href="'+( MiniProfiler.moreUrl(it.timing.name) )+'" class="profiler-more-actions">more</a> ';if(it.custom_link){out+=' <a href="'+( it.custom_link )+'" class="profiler-custom-link" target="_blank">'+( it.custom_link_name )+'</a> ';}out+=' ';if(it.has_trivial_timings){out+=' <a class="profiler-toggle-trivial" data-show-on-load="'+( it.has_all_trivial_timings )+'" title="toggles any rows with < '+( it.trivial_duration_threshold_milliseconds )+' ms"> show trivial </a> ';}return out;
|
|
14
|
+
var out=' <a href="'+( MiniProfiler.shareUrl(it.page.id) )+'" class="profiler-share-profiler-results" target="_blank">share</a> <a href="'+( MiniProfiler.moreUrl(it.timing.name) )+'" class="profiler-more-actions">more</a> ';if(it.custom_link){out+=' <a href="'+( it.custom_link )+'" class="profiler-custom-link" target="_blank">'+( it.custom_link_name )+'</a> ';}out+=' ';if(it.page.has_trivial_timings){out+=' <a class="profiler-toggle-trivial" data-show-on-load="'+( it.page.has_all_trivial_timings )+'" title="toggles any rows with < '+( it.page.trivial_duration_threshold_milliseconds )+' ms"> show trivial </a> ';}return out;
|
|
15
15
|
}
|
|
16
16
|
MiniProfiler.templates["timingTemplate"] = function anonymous(it
|
|
17
17
|
) {
|
@@ -152,7 +152,7 @@ module Rack
|
|
152
152
|
resources_env = env.dup
|
153
153
|
resources_env['PATH_INFO'] = file_name
|
154
154
|
|
155
|
-
rack_file = Rack::File.new(MiniProfiler.resources_root, 'Cache-Control' =>
|
155
|
+
rack_file = Rack::File.new(MiniProfiler.resources_root, 'Cache-Control' => "max-age:#{cache_control_value}")
|
156
156
|
rack_file.call(resources_env)
|
157
157
|
end
|
158
158
|
|
@@ -673,5 +673,8 @@ Append the following to your query string:
|
|
673
673
|
current.inject_js = false
|
674
674
|
end
|
675
675
|
|
676
|
+
def cache_control_value
|
677
|
+
86400
|
678
|
+
end
|
676
679
|
end
|
677
680
|
end
|
data/rack-mini-profiler.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-mini-profiler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Saffron
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2020-
|
13
|
+
date: 2020-05-25 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rack
|
@@ -194,6 +194,20 @@ dependencies:
|
|
194
194
|
- - ">="
|
195
195
|
- !ruby/object:Gem::Version
|
196
196
|
version: '0'
|
197
|
+
- !ruby/object:Gem::Dependency
|
198
|
+
name: listen
|
199
|
+
requirement: !ruby/object:Gem::Requirement
|
200
|
+
requirements:
|
201
|
+
- - ">="
|
202
|
+
- !ruby/object:Gem::Version
|
203
|
+
version: '0'
|
204
|
+
type: :development
|
205
|
+
prerelease: false
|
206
|
+
version_requirements: !ruby/object:Gem::Requirement
|
207
|
+
requirements:
|
208
|
+
- - ">="
|
209
|
+
- !ruby/object:Gem::Version
|
210
|
+
version: '0'
|
197
211
|
description: Profiling toolkit for Rack applications with Rails integration. Client
|
198
212
|
Side profiling, DB profiling and Server profiling.
|
199
213
|
email: sam.saffron@gmail.com
|