rails_performance 1.2.0.alpha1 → 1.2.0.alpha2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7b526cdf667201a0ea200a83af542812f0be52724409ce9e2573ca878d2efd06
4
- data.tar.gz: 26b5591a60b14647cdd713615e1d3e7163e840d1048466deba94241aab762544
3
+ metadata.gz: d3e98e1e0b65848122215689445e0687260d6ef641d5f3f68bb341abca10fab0
4
+ data.tar.gz: eaf9399287f35a89b26974a376fd504bd9389b273c0406a3a489e496de4443c5
5
5
  SHA512:
6
- metadata.gz: 0acf1b56c93e1bfb3085fccf239839a96e92a4f92eb55633fbeaca3371a33427bbcbc97091124c864fb2ca8743a338c33fd77c95ece6d85982c9e276bb12bc5f
7
- data.tar.gz: b2a8d5c8460c047f0614f6bae5124512e892e21d88f58c45578ce838dfefe16cd8aff3fce1c7838e5061d090e1df88047ea52ec6d8ce38f36346e1ce65d0b82b
6
+ metadata.gz: 148a68c40fe1cc8f360ae06583a71605bfb355cac4a49e9490d60db6940d08cea2a4fab7b61a76c3061fb4d93fe47bcf872b4cba3d8682d9151615300caef22a
7
+ data.tar.gz: eff97dc7df277c5a523a932437a4318371e9cfb5fc2821699f6e413a0d70287607e9049cb395cb377c5d987787b65eb4a6715aa0cecf87d13a1a85ac7bf49f33
@@ -1,6 +1,5 @@
1
1
  module RailsPerformance
2
2
  module ApplicationHelper
3
- include LocalTimeHelper
4
3
 
5
4
  def round_it(value, limit = 1)
6
5
  return nil unless value
@@ -107,9 +106,8 @@ module RailsPerformance
107
106
  end
108
107
 
109
108
  def format_datetime(e)
110
- #e.strftime("%Y-%m-%d %H:%M:%S")
111
- # I18n.l(e, format: "%Y-%m-%d %H:%M:%S")
112
- local_time(e, "%Y-%m-%d %H:%M:%S")
109
+ dt = RailsPerformance::Reports::BaseReport::time_in_app_time_zone(e)
110
+ I18n.l(dt, format: "%Y-%m-%d %H:%M:%S")
113
111
  end
114
112
 
115
113
  def active?(section)
@@ -1,7 +1,6 @@
1
1
  <%= insert_js_file 'jquery-3.4.1.min.js' %>
2
2
  <%= insert_js_file 'rails.js' %>
3
3
  <%= insert_js_file 'stupidtable.min.js' %>
4
- <%= insert_js_file 'local-time.es2017-umd.js' %>
5
4
 
6
5
  <%= javascript_include_tag 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/js/all.min.js' %>
7
6
  <%= javascript_include_tag 'https://code.highcharts.com/highcharts.js' %>
@@ -1,8 +1,8 @@
1
1
  function showTIRChart(div, data, addon, name) {
2
2
  Highcharts.chart(div, {
3
- time: {
4
- timezone: 'Europe/Kiev'
5
- },
3
+ // time: {
4
+ // timezone: 'Europe/Kiev'
5
+ // },
6
6
  chart: {
7
7
  type: 'area',
8
8
  zoomType: 'x',
@@ -84,9 +84,9 @@ function showTIRChart(div, data, addon, name) {
84
84
 
85
85
  function showRTChart(div, data) {
86
86
  Highcharts.chart(div, {
87
- time: {
88
- timezone: 'Europe/Kiev'
89
- },
87
+ // time: {
88
+ // timezone: 'Europe/Kiev'
89
+ // },
90
90
  chart: {
91
91
  type: 'area',
92
92
  zoomType: 'x',
@@ -203,5 +203,3 @@ if(recent) {
203
203
  })
204
204
  }, 3000);
205
205
  }
206
-
207
- LocalTime.start()
@@ -20,6 +20,15 @@ module RailsPerformance
20
20
  end
21
21
 
22
22
  def set_defaults; end
23
+
24
+ def self.time_in_app_time_zone(time)
25
+ app_time_zone = ::Rails.application.config.time_zone
26
+ if app_time_zone.present?
27
+ time.in_time_zone(app_time_zone)
28
+ else
29
+ time
30
+ end
31
+ end
23
32
  end
24
33
  end
25
- end
34
+ end
@@ -25,7 +25,8 @@ module RailsPerformance
25
25
  # add blank columns
26
26
  while current <= stop
27
27
  views = all[current.strftime(RailsPerformance::FORMAT)] || 0
28
- @data << [(current.to_i + offset) * 1000, views.round(2)]
28
+ time = RailsPerformance::Reports::ResponseTimeReport::time_in_app_time_zone(current)
29
+ @data << [(time.to_i + offset) * 1000, views.round(2)]
29
30
  current += 1.minute
30
31
  end
31
32
 
@@ -24,7 +24,8 @@ module RailsPerformance
24
24
  # add blank columns
25
25
  while current <= stop
26
26
  views = all[current.strftime(RailsPerformance::FORMAT)] || 0
27
- @data << [(current.to_i + offset) * 1000, views.to_i]
27
+ time = RailsPerformance::Reports::ResponseTimeReport::time_in_app_time_zone(current)
28
+ @data << [(time.to_i + offset) * 1000, views.round(2)]
28
29
  current += 1.minute
29
30
  end
30
31
 
@@ -1,4 +1,4 @@
1
1
  module RailsPerformance
2
- VERSION = '1.2.0.alpha1'
2
+ VERSION = '1.2.0.alpha2'
3
3
  SCHEMA = '1.0.1'
4
4
  end
@@ -1,6 +1,5 @@
1
1
  require "redis"
2
2
  require "redis-namespace"
3
- require "local_time"
4
3
  require_relative "./rails_performance/version.rb"
5
4
  require_relative "rails_performance/rails/query_builder.rb"
6
5
  require_relative "rails_performance/rails/middleware.rb"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_performance
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0.alpha1
4
+ version: 1.2.0.alpha2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Kasyanchuk
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: local_time
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: sqlite3
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -248,7 +234,6 @@ files:
248
234
  - app/views/rails_performance/javascripts/_javascripts.html.erb
249
235
  - app/views/rails_performance/javascripts/app.js
250
236
  - app/views/rails_performance/javascripts/jquery-3.4.1.min.js
251
- - app/views/rails_performance/javascripts/local-time.es2017-umd.js
252
237
  - app/views/rails_performance/javascripts/navbar.js
253
238
  - app/views/rails_performance/javascripts/panel.js
254
239
  - app/views/rails_performance/javascripts/rails.js
@@ -1 +0,0 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).LocalTime=e()}(this,(function(){"use strict";var t;t={config:{},run:function(){return this.getController().processElements()},process:function(...t){var e,r,a;for(r=0,a=t.length;r<a;r++)e=t[r],this.getController().processElement(e);return t.length},getController:function(){return null!=this.controller?this.controller:this.controller=new t.Controller}};var e,r,a,n,s,i,o,u,l,c,d,m,h,f,g,y,p,v,b,S,M,T,D,E,w,A,N,O,$,C=t;return C.config.i18n={en:{date:{dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbrDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],abbrMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],yesterday:"yesterday",today:"today",tomorrow:"tomorrow",on:"on {date}",formats:{default:"%b %e, %Y",thisYear:"%b %e"}},time:{am:"am",pm:"pm",singular:"a {time}",singularAn:"an {time}",elapsed:"{time} ago",second:"second",seconds:"seconds",minute:"minute",minutes:"minutes",hour:"hour",hours:"hours",formats:{default:"%l:%M%P"}},datetime:{at:"{date} at {time}",formats:{default:"%B %e, %Y at %l:%M%P %Z"}}}},C.config.locale="en",C.config.defaultLocale="en",C.config.timerInterval=6e4,a=!isNaN(Date.parse("2011-01-01T12:00:00-05:00")),C.parseDate=function(t){return t=t.toString(),a||(t=r(t)),new Date(Date.parse(t))},e=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(Z|[-+]?[\d:]+)$/,r=function(t){var r,a,n,s,i,o,u,l,c,d;if(s=t.match(e))return[r,c,o,a,n,i,l,d]=s,"Z"!==d&&(u=d.replace(":","")),`${c}/${o}/${a} ${n}:${i}:${l} GMT${[u]}`},C.elementMatchesSelector=(n=document.documentElement,s=null!=(i=null!=(o=null!=(u=null!=(l=n.matches)?l:n.matchesSelector)?u:n.webkitMatchesSelector)?o:n.mozMatchesSelector)?i:n.msMatchesSelector,function(t,e){if((null!=t?t.nodeType:void 0)===Node.ELEMENT_NODE)return s.call(t,e)}),({config:c}=C),({i18n:m}=c),C.getI18nValue=function(t="",{locale:e}={locale:c.locale}){var r;return null!=(r=d(m[e],t))?r:e!==c.defaultLocale?C.getI18nValue(t,{locale:c.defaultLocale}):void 0},C.translate=function(t,e={},r){var a,n,s;for(a in s=C.getI18nValue(t,r),e)n=e[a],s=s.replace(`{${a}}`,n);return s},d=function(t,e){var r,a,n,s,i;for(i=t,r=0,n=(s=e.split(".")).length;r<n;r++){if(null==i[a=s[r]])return null;i=i[a]}return i},({getI18nValue:h,translate:p}=C),C.strftime=y=function(t,e){var r,a,n,s,i,o,u;return a=t.getDay(),r=t.getDate(),i=t.getMonth(),u=t.getFullYear(),n=t.getHours(),s=t.getMinutes(),o=t.getSeconds(),e.replace(/%(-?)([%aAbBcdeHIlmMpPSwyYZ])/g,(function(e,l,c){switch(c){case"%":return"%";case"a":return h("date.abbrDayNames")[a];case"A":return h("date.dayNames")[a];case"b":return h("date.abbrMonthNames")[i];case"B":return h("date.monthNames")[i];case"c":return t.toString();case"d":return f(r,l);case"e":return r;case"H":return f(n,l);case"I":return f(y(t,"%l"),l);case"l":return 0===n||12===n?12:(n+12)%12;case"m":return f(i+1,l);case"M":return f(s,l);case"p":return p("time."+(n>11?"pm":"am")).toUpperCase();case"P":return p("time."+(n>11?"pm":"am"));case"S":return f(o,l);case"w":return a;case"y":return f(u%100,l);case"Y":return u;case"Z":return g(t)}}))},f=function(t,e){return"-"===e?t:`0${t}`.slice(-2)},g=function(t){var e,r,a,n,s;return(e=null!=(r=(s=t.toString()).match(/\(([\w\s]+)\)$/))?r[1]:void 0)?/\s/.test(e)?e.match(/\b(\w)/g).join(""):e:(e=null!=(a=s.match(/(\w{3,4})\s\d{4}$/))?a[1]:void 0)||(e=null!=(n=s.match(/(UTC[\+\-]\d+)/))?n[1]:void 0)?e:""},C.CalendarDate=class{static fromDate(t){return new this(t.getFullYear(),t.getMonth()+1,t.getDate())}static today(){return this.fromDate(new Date)}constructor(t,e,r){this.date=new Date(Date.UTC(t,e-1)),this.date.setUTCDate(r),this.year=this.date.getUTCFullYear(),this.month=this.date.getUTCMonth()+1,this.day=this.date.getUTCDate(),this.value=this.date.getTime()}equals(t){return(null!=t?t.value:void 0)===this.value}is(t){return this.equals(t)}isToday(){return this.is(this.constructor.today())}occursOnSameYearAs(t){return this.year===(null!=t?t.year:void 0)}occursThisYear(){return this.occursOnSameYearAs(this.constructor.today())}daysSince(t){if(t)return(this.date-t.date)/864e5}daysPassed(){return this.constructor.today().daysSince(this)}},({strftime:b,translate:S,getI18nValue:v}=C),C.RelativeTime=class{constructor(t){this.date=t,this.calendarDate=C.CalendarDate.fromDate(this.date)}toString(){var t,e;return(e=this.toTimeElapsedString())?S("time.elapsed",{time:e}):(t=this.toWeekdayString())?(e=this.toTimeString(),S("datetime.at",{date:t,time:e})):S("date.on",{date:this.toDateString()})}toTimeOrDateString(){return this.calendarDate.isToday()?this.toTimeString():this.toDateString()}toTimeElapsedString(){var t,e,r,a,n;return r=(new Date).getTime()-this.date.getTime(),a=Math.round(r/1e3),e=Math.round(a/60),t=Math.round(e/60),r<0?null:a<10?(n=S("time.second"),S("time.singular",{time:n})):a<45?`${a} ${S("time.seconds")}`:a<90?(n=S("time.minute"),S("time.singular",{time:n})):e<45?`${e} ${S("time.minutes")}`:e<90?(n=S("time.hour"),S("time.singularAn",{time:n})):t<24?`${t} ${S("time.hours")}`:""}toWeekdayString(){switch(this.calendarDate.daysPassed()){case 0:return S("date.today");case 1:return S("date.yesterday");case-1:return S("date.tomorrow");case 2:case 3:case 4:case 5:case 6:return b(this.date,"%A");default:return""}}toDateString(){var t;return t=this.calendarDate.occursThisYear()?v("date.formats.thisYear"):v("date.formats.default"),b(this.date,t)}toTimeString(){return b(this.date,v("time.formats.default"))}},({elementMatchesSelector:M}=C),C.PageObserver=class{constructor(t,e){this.processMutations=this.processMutations.bind(this),this.processInsertion=this.processInsertion.bind(this),this.selector=t,this.callback=e}start(){if(!this.started)return this.observeWithMutationObserver()||this.observeWithMutationEvent(),this.started=!0}observeWithMutationObserver(){if("undefined"!=typeof MutationObserver&&null!==MutationObserver)return new MutationObserver(this.processMutations).observe(document.documentElement,{childList:!0,subtree:!0}),!0}observeWithMutationEvent(){return addEventListener("DOMNodeInserted",this.processInsertion,!1),!0}findSignificantElements(t){var e;return e=[],(null!=t?t.nodeType:void 0)===Node.ELEMENT_NODE&&(M(t,this.selector)&&e.push(t),e.push(...t.querySelectorAll(this.selector))),e}processMutations(t){var e,r,a,n,s,i,o,u;for(e=[],r=0,n=t.length;r<n;r++)if("childList"===(i=t[r]).type)for(a=0,s=(u=i.addedNodes).length;a<s;a++)o=u[a],e.push(...this.findSignificantElements(o));return this.notify(e)}processInsertion(t){var e;return e=this.findSignificantElements(t.target),this.notify(e)}notify(t){if(null!=t?t.length:void 0)return"function"==typeof this.callback?this.callback(t):void 0}},({parseDate:E,strftime:w,getI18nValue:D,config:T}=C),C.Controller=function(){var t,e,r;return t="time[data-local]:not([data-localized])",e=function(t){return t.setAttribute("data-localized","")},r=function(t){return new C.RelativeTime(t)},class{constructor(){this.processElements=this.processElements.bind(this),this.pageObserver=new C.PageObserver(t,this.processElements)}start(){if(!this.started)return this.processElements(),this.startTimer(),this.pageObserver.start(),this.started=!0}startTimer(){var t;if(t=T.timerInterval)return null!=this.timer?this.timer:this.timer=setInterval(this.processElements,t)}processElements(e=document.querySelectorAll(t)){var r,a,n;for(a=0,n=e.length;a<n;a++)r=e[a],this.processElement(r);return e.length}processElement(t){var a,n,s,i,o,u;if(n=t.getAttribute("datetime"),s=t.getAttribute("data-format"),i=t.getAttribute("data-local"),o=E(n),!isNaN(o))return t.hasAttribute("title")||(u=w(o,D("datetime.formats.default")),t.setAttribute("title",u)),t.textContent=a=function(){switch(i){case"time":return e(t),w(o,s);case"date":return e(t),r(o).toDateString();case"time-ago":return r(o).toString();case"time-or-date":return r(o).toTimeOrDateString();case"weekday":return r(o).toWeekdayString();case"weekday-or-date":return r(o).toWeekdayString()||r(o).toDateString()}}(),t.hasAttribute("aria-label")?void 0:t.setAttribute("aria-label",a)}}}.call(window),$=!1,A=function(){return document.attachEvent?"complete"===document.readyState:"loading"!==document.readyState},N=function(t){var e;return null!=(e="function"==typeof requestAnimationFrame?requestAnimationFrame(t):void 0)?e:setTimeout(t,17)},O=function(){return C.getController().start()},C.start=function(){if(!$)return $=!0,"undefined"!=typeof MutationObserver&&null!==MutationObserver||A()?O():N(O)},window.LocalTime===C&&C.start(),C}));