rack-mini-profiler 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 17348c5390dc454187e6cfd559e9fc955fdcbedbb09f7bec83cb403c5533616d
4
- data.tar.gz: 5a6c7706f4650bd3e27602afc2d394425b99bde022d055f79c9cf8647d3f3df1
3
+ metadata.gz: b7fcca7a28de2898e8e320f2f94db5d96eee3128b9be7a48053e472036a6ef95
4
+ data.tar.gz: 3a21bb993d77ef33baca78135716ab0e44dfbd28eefbb8874bae0b9a715ccb3f
5
5
  SHA512:
6
- metadata.gz: f177af4784547eb49be197a7e2be873124ecfbba021f1bc0f6f4fedc1622c9fb2a525a0d991155fe43868eb499804304bb98d7cf9e5fad38033a0001981bc8c0
7
- data.tar.gz: 01eec1e79eb80e82b94d50cae8d763ba19d1bdce6d126dadb5be9c28abc0e038fe49ca2d2dd6ea39316f493b4e8ecc12069c9435bf50c57e491548278e9c2e34
6
+ metadata.gz: 2b4a31ef4e964fbd76646425d1ff16007c56d77360c6ad1f6923e753cd8830614098867ce06d5a554810564674b654b8868b1cdddc9c815942e25314459b3de4
7
+ data.tar.gz: fb3a9d99bb23a5e5d7b1518cd122a4240658b6c0c5d0c06f1852ddf472e9761cf9e46db5ce6cdcd92d574ec81ec3789f42aee51fe9ee20d8f587b51059cd55e1
@@ -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
  ```
@@ -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 = "id="
151
- .concat(id, "&clientPerformance=")
152
- .concat(clientPerformance, "&clientProbes=")
153
- .concat(clientProbes, "&popup=1");
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(params);
168
+ request.send(queryParam);
176
169
  })();
177
170
  }
178
171
  }
179
172
  };
180
173
 
181
- var extend = function extend(out) {
182
- out = out || {};
183
-
184
- for (var i = 1; i < _arguments.length; i++) {
185
- if (!_arguments[i]) continue;
186
-
187
- for (var key in _arguments[i]) {
188
- if (_arguments[i].hasOwnProperty(key)) out[key] = _arguments[i][key];
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
- return out;
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) {
@@ -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 &lt; {{= 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 &lt; {{= it.page.trivial_duration_threshold_milliseconds }} ms">
133
133
  show trivial
134
134
  </a>
135
135
  {{?}}
@@ -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 &lt; '+( 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 &lt; '+( it.page.trivial_duration_threshold_milliseconds )+' ms"> show trivial </a> ';}return out;
15
15
  }
16
16
  MiniProfiler.templates["timingTemplate"] = function anonymous(it
17
17
  ) {
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module Rack
3
3
  class MiniProfiler
4
- ASSET_VERSION = '67dd1c2571ced7fc74ae7f1813e47bdf'
4
+ ASSET_VERSION = '22e813e9a683ebee90a5afa948cffb0b'
5
5
  end
6
6
  end
@@ -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' => 'max-age:86400')
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rack
4
4
  class MiniProfiler
5
- VERSION = '2.0.1'
5
+ VERSION = '2.0.2'
6
6
  end
7
7
  end
@@ -40,6 +40,7 @@ Gem::Specification.new do |s|
40
40
  s.add_development_dependency 'mini_racer'
41
41
  s.add_development_dependency 'nokogiri'
42
42
  s.add_development_dependency 'rubocop-discourse'
43
+ s.add_development_dependency 'listen'
43
44
 
44
45
  s.require_paths = ["lib"]
45
46
  end
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.1
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-03-17 00:00:00.000000000 Z
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