logster 2.6.1 → 2.6.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 +9 -0
- data/Rakefile +1 -1
- data/assets/javascript/client-app.js +39 -38
- data/client-app/app/components/back-trace.js +4 -2
- data/client-app/app/components/env-tab.js +6 -14
- data/client-app/app/components/page-nav.js +3 -0
- data/client-app/app/helpers/logster-url.js +2 -2
- data/client-app/app/index.html +1 -1
- data/client-app/app/initializers/app-init.js +16 -1
- data/client-app/app/lib/preload.js +11 -2
- data/client-app/app/lib/utilities.js +34 -24
- data/client-app/app/models/message-collection.js +2 -1
- data/client-app/app/models/message.js +2 -2
- data/client-app/preload-json-manager.rb +6 -26
- data/client-app/tests/integration/components/back-trace-test.js +8 -2
- data/client-app/tests/integration/components/env-tab-test.js +26 -0
- data/client-app/tests/integration/components/patterns-list-test.js +1 -1
- data/lib/logster/middleware/viewer.rb +16 -14
- data/lib/logster/version.rb +1 -1
- metadata +2 -3
- data/client-app/tests/unit/initializers/app-init-test.js +0 -31
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f3e8e70cfba330bd669fd9a1957e87ff506d4e62b57a1cb033a13a790c89b0d0
|
|
4
|
+
data.tar.gz: 95b85f82307e45a3097d126dee293161cd3df88efbd612b01c6ba8e7acda8f64
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 643be65fc5fa5de070f932c0d333b0a01a8300ff2c50118b82ddeda4ddbb034a663a00d3ed2c2898dbcecf536c7d7092d360fd9ba4b8b959c650eb276919e310
|
|
7
|
+
data.tar.gz: 6fe96f60769edf2c23b61450401e873013b791c6b116104d35e6860acb889f1e26f2e79472b023ba1c6d534528b45a39ded046746bfe12bde381b50e03dccb1b
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
- 2020-02-09: 2.6.2
|
|
4
|
+
|
|
5
|
+
- FIX: Regression with rendering single env when `env_expandable_keys` config is present
|
|
6
|
+
- DEV: Fix Ember deprecations in tests
|
|
7
|
+
- DEV: Add more tests to env rendering
|
|
8
|
+
- FIX: Backtrace frames from gems should be linkified even when they don't start with `gems_dir`
|
|
9
|
+
- DEV: Allow Ember server to inherit preload data from Sinatra server
|
|
10
|
+
- FIX: Fetch env when navigating through grouped messages
|
|
11
|
+
|
|
3
12
|
- 2020-02-07: 2.6.1
|
|
4
13
|
|
|
5
14
|
- FIX: Fetch env when row is selected to allow copy to work on Firefox
|
data/Rakefile
CHANGED
|
@@ -12,7 +12,7 @@ task(default: :test)
|
|
|
12
12
|
desc "Starts Sinatra and Ember servers"
|
|
13
13
|
task :client_dev do
|
|
14
14
|
begin
|
|
15
|
-
pid = spawn("cd website && BUNDLE_GEMFILE=Gemfile bundle exec rackup")
|
|
15
|
+
pid = spawn("cd website && LOGSTER_ENV=development BUNDLE_GEMFILE=Gemfile bundle exec rackup --host 0.0.0.0")
|
|
16
16
|
pid2 = spawn("cd client-app && ember s --proxy http://localhost:9292")
|
|
17
17
|
Process.wait pid
|
|
18
18
|
Process.wait pid2
|
|
@@ -6,7 +6,7 @@ return s=(0,n.default)(this,(e=(0,a.default)(l)).call.apply(e,[this].concat(d)))
|
|
|
6
6
|
e.default=c,(0,l.default)(c,u.default.modulePrefix)})),define("client-app/component-managers/glimmer",["exports","@glimmer/component/-private/ember-component-manager"],(function(e,t){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t.default}})})),define("client-app/components/actions-menu",["exports","@babel/runtime/helpers/esm/applyDecoratedDescriptor","client-app/lib/decorators"],(function(e,t,n){var a
|
|
7
7
|
Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
|
|
8
8
|
var r=Ember.Component.extend((a={showMenu:!1,tagName:"span",outsideClickHandler:function(e){this.element&&!this.element.contains(e.target)&&this.element!==e.target&&(this.set("showMenu",!1),this.updateMenu())},updateMenu:function(){this.showMenu?this.addOutsideClickHandler():this.removeOutsideClickHandler()},addOutsideClickHandler:function(){document.addEventListener("click",this.outsideClickHandler)},removeOutsideClickHandler:function(){document.removeEventListener("click",this.outsideClickHandler)},willDestroyElement:function(){this._super.apply(this,arguments),this.removeOutsideClickHandler()},actions:{expandMenu:function(){this.toggleProperty("showMenu"),this.updateMenu()},share:function(){this.share()}}},(0,t.default)(a,"outsideClickHandler",[n.bound],Object.getOwnPropertyDescriptor(a,"outsideClickHandler"),a),a))
|
|
9
|
-
e.default=r})),define("client-app/components/back-trace",["exports","@babel/runtime/helpers/esm/slicedToArray","client-app/lib/preload"],(function(e,t,n){function a(e,t){return!(!e||!t||t.length>e.length)&&e.substring(0,t.length)
|
|
9
|
+
e.default=r})),define("client-app/components/back-trace",["exports","@babel/runtime/helpers/esm/slicedToArray","client-app/lib/preload"],(function(e,t,n){function a(e,t){return!(!e||!t||t.length>e.length)&&e.substring(0,t.length)===t}function r(){return n.default.get("backtrace_links_enabled")}function s(e){return e&&"/"!==e[e.length-1]?e+"/":e}function i(e){var t=e.repo,n=e.path,a=e.filename,r=e.lineNumber,i=e.commitSha,o=void 0===i?null:i,l=s(t)
|
|
10
10
|
return/\/tree\//.test(l)||(l+="blob/",l+=o?"".concat(o,"/"):"master/"),l+=n+a,/^[0-9]+$/.test(r)&&(l+="#L".concat(r)),l}Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
|
|
11
11
|
var o=Ember.Component.extend({GithubURLForGem:function(e){var s=null
|
|
12
12
|
if(!r())return s
|
|
@@ -18,16 +18,17 @@ if(l){var u,c,d,p=s(l.path),f=e.substring(p.length),m="",h=-1!==f.indexOf("/"),v
|
|
|
18
18
|
if(h){var b=f.match(v)||[],g=(0,t.default)(b,5)
|
|
19
19
|
m=g[1],u=g[2],c=g[3],d=g[4]}else{var y=f.match(v)||[],E=(0,t.default)(y,4)
|
|
20
20
|
u=E[1],c=E[2],d=E[3]}if(u&&c&&d){var x=l.main_app?this.commitSha:null
|
|
21
|
-
o=i({repo:l.url,path:m,filename:u,lineNumber:c,commitSha:x})}}return o},findGithubURL:function(e,t){
|
|
21
|
+
o=i({repo:l.url,path:m,filename:u,lineNumber:c,commitSha:x})}}return o},findGithubURL:function(e,t){var r=n.default.get("directories")||[],s=a(e,n.default.get("gems_dir")),i=r.some((function(t){return a(e,t.path)}))
|
|
22
|
+
return s||!i?this.GithubURLForGem(t):this.GithubURLForApp(e)},commitSha:Ember.computed("env",(function(){var e=null
|
|
22
23
|
return Array.isArray(this.env)?e=this.env.map((function(e){return e.application_version})).filter((function(e){return e}))[0]:this.env&&(e=this.env.application_version),e||n.default.get("application_version")})),lines:Ember.computed("backtrace","commitSha",(function(){var e=this
|
|
23
24
|
return this.backtrace&&0!==this.backtrace.length?this.backtrace.split("\n").map((function(t){var r=function(e){if(a(e,n.default.get("gems_dir"))){var t=n.default.get("gems_dir")
|
|
24
25
|
return e.substring(t.length)}return e}(t)
|
|
25
26
|
return{line:r,url:e.findGithubURL(t,r)}})):[]}))})
|
|
26
27
|
e.default=o})),define("client-app/components/env-tab",["exports","client-app/lib/utilities","client-app/lib/preload"],(function(e,t,n){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
|
|
27
28
|
var a=Ember.Component.extend({currentEnv:Ember.computed("isEnvArray","currentEnvPosition",(function(){return this.isEnvArray?this.message.env[this.currentEnvPosition]:this.message.env})),isEnvArray:Ember.computed("message.env",(function(){return Array.isArray(this.get("message.env"))})),html:Ember.computed("isEnvArray","currentEnv","expanded.[]",(function(){var e=this
|
|
28
|
-
if(this.isEnvArray){var a=
|
|
29
|
-
return
|
|
30
|
-
e.message.env.forEach((function(e){e[t]&&-1===n.indexOf(e[t])&&n.push(e[t])})),
|
|
29
|
+
if(this.isEnvArray){var a=(0,t.clone)(this.currentEnv)
|
|
30
|
+
return(n.default.get("env_expandable_keys")||[]).forEach((function(t){if(a.hasOwnProperty(t)&&!Array.isArray(a[t])){var n=[a[t]]
|
|
31
|
+
e.message.env.forEach((function(e){e[t]&&-1===n.indexOf(e[t])&&n.push(e[t])})),a[t]=n.length>1?n:n[0]}})),(0,t.buildHashString)(a,!1,this.expanded||[])}return(0,t.buildHashString)(this.get("message.env"))})),click:function(e){var t=e.target,a=t.dataset.key;-1!==(n.default.get("env_expandable_keys")||[]).indexOf(a)&&t.classList.contains("expand-list")&&(e.preventDefault(),this.expanded?this.expanded.pushObject(a):this.set("expanded",[a]))}})
|
|
31
32
|
e.default=a})),define("client-app/components/message-info",["exports","client-app/lib/preload"],(function(e,t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
|
|
32
33
|
var n=Ember.Component.extend({showSolveAllButton:Ember.computed.bool("currentRow.group"),buttons:Ember.computed("currentMessage.protected","showSolveButton",(function(){var e=this.get("currentMessage.protected"),t=[]
|
|
33
34
|
return!e&&this.showSolveButton&&t.push({klass:"solve",action:"solve",icon:"check-square-o",label:"Solve",danger:!0}),this.showSolveAllButton&&t.push({klass:"solve-all",action:"solveAll",icon:"check-square-o",label:"Solve All",danger:!0}),e?t.push({klass:"unprotect",action:"unprotect",icon:"unlock",label:"Unprotect"}):t.push({klass:"remove",action:"remove",icon:"trash-o",label:"Remove",danger:!0},{klass:"protect",action:"protect",icon:"lock",label:"Protect"}),t.push({klass:"copy",action:"copyAction",icon:"clipboard",label:"Copy"}),t})),showSolveButton:Ember.computed("showSolveAllButton","currentMessage.{canSolve,env}",(function(){return!this.showSolveAllButton&&(this.currentMessage.env?this.currentMessage.canSolve:!!t.default.get("application_version"))})),copy:function(){var e=document.createElement("TEXTAREA")
|
|
@@ -41,8 +42,9 @@ if(e){var a=parseFloat(getComputedStyle(e).height)
|
|
|
41
42
|
n=e.scrollHeight-20<a+e.scrollTop,t=!0}}},didInsertElement:function(){var e=document.getElementById("top-panel")
|
|
42
43
|
e&&(t=!1,n&&(n=!1,e.scrollTop=e.scrollHeight-parseFloat(getComputedStyle(e).height)))}})
|
|
43
44
|
e.default=a})),define("client-app/components/page-nav",["exports"],(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
|
|
44
|
-
var t=Ember.Component.extend({classNames:["nav-controls"],classNameBindings:["extraClasses"],disableBackButtons:Ember.computed.equal("position",0),disableForwardButtons:Ember.computed("position","list.length",(function(){return this.position===this.get("list.length")-1})),displayNumber:Ember.computed("position",(function(){return this.position+1})),actions:{takeStep:function(e){var t="back"===e?-1:1
|
|
45
|
-
this.
|
|
45
|
+
var t=Ember.Component.extend({classNames:["nav-controls"],classNameBindings:["extraClasses"],disableBackButtons:Ember.computed.equal("position",0),disableForwardButtons:Ember.computed("position","list.length",(function(){return this.position===this.get("list.length")-1})),displayNumber:Ember.computed("position",(function(){return this.position+1})),actions:{takeStep:function(e){var t="back"===e?-1:1
|
|
46
|
+
if(!(1===t&&this.disableForwardButtons||-1===t&&this.disableBackButtons)){var n=this.position+t
|
|
47
|
+
this.navigate(n)}},bigJump:function(e){var t="back"===e?0:this.get("list.length")-1
|
|
46
48
|
this.navigate(t)}}})
|
|
47
49
|
e.default=t})),define("client-app/components/panel-resizer",["exports","@babel/runtime/helpers/esm/applyDecoratedDescriptor","client-app/lib/decorators"],(function(e,t,n){var a
|
|
48
50
|
Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
|
|
@@ -92,7 +94,7 @@ e.default=t})),define("client-app/data-adapter",["exports","@ember-data/debug"],
|
|
|
92
94
|
return s&&(a.showExtended&&(o=r.match(n.versionExtendedRegExp)),o||(o=r.match(n.versionRegExp))),i&&(o=r.match(n.shaRegExp)),o?o[0]:r}Object.defineProperty(e,"__esModule",{value:!0}),e.appVersion=a,e.default=void 0
|
|
93
95
|
var r=Ember.Helper.helper(a)
|
|
94
96
|
e.default=r})),define("client-app/helpers/logster-url",["exports","client-app/lib/preload"],(function(e,t){function n(e){var n=e[0]
|
|
95
|
-
return"/"!==n[0]&&(n="/".concat(n)),t.
|
|
97
|
+
return"/"!==n[0]&&(n="/".concat(n)),(0,t.getRootPath)()+n}Object.defineProperty(e,"__esModule",{value:!0}),e.logsterUrl=n,e.default=void 0
|
|
96
98
|
var a=Ember.Helper.helper(n)
|
|
97
99
|
e.default=a})),define("client-app/helpers/or",["exports"],(function(e){function t(e){return e.some((function(e){return e}))}Object.defineProperty(e,"__esModule",{value:!0}),e.or=t,e.default=void 0
|
|
98
100
|
var n=Ember.Helper.helper(t)
|
|
@@ -100,14 +102,13 @@ e.default=n})),define("client-app/helpers/pluralize",["exports","ember-inflector
|
|
|
100
102
|
var n=t.default
|
|
101
103
|
e.default=n})),define("client-app/helpers/singularize",["exports","ember-inflector/lib/helpers/singularize"],(function(e,t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
|
|
102
104
|
var n=t.default
|
|
103
|
-
e.default=n})),define("client-app/initializers/app-init",["exports","client-app/lib/utilities"],(function(e,t){Object.defineProperty(e,"__esModule",{value:!0}),e.initialize=
|
|
104
|
-
var
|
|
105
|
-
function
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
e.default=r})),define("client-app/initializers/app-version",["exports","ember-cli-app-version/initializer-factory","client-app/config/environment"],(function(e,t,n){var a,r
|
|
105
|
+
e.default=n})),define("client-app/initializers/app-init",["exports","client-app/lib/utilities","client-app/lib/preload"],(function(e,t,n){Object.defineProperty(e,"__esModule",{value:!0}),e.initialize=r,e.default=void 0
|
|
106
|
+
var a=["component","route"]
|
|
107
|
+
function r(e){var r,s,i=e.resolveRegistration("config:environment");(0,n.setRootPath)(i.rootURL.replace(/\/$/,"")),"development"===i.environment&&(e.deferReadiness(),(0,t.ajax)("/development-preload.json").then((function(e){document.getElementById("preloaded-data").setAttribute("data-preloaded",JSON.stringify(e))})).catch((function(e){return console.error("Fetching preload data failed.",e)})).finally((function(){return e.advanceReadiness()}))),moment.updateLocale("en",{relativeTime:{future:"in %s",past:"%s ago",s:"secs",m:"a min",mm:"%d mins",h:"an hr",hh:"%d hrs",d:"a day",dd:"%d days",M:"a mth",MM:"%d mths",y:"a yr",yy:"%d yrs"}}),["","webkit","ms","moz","ms"].forEach((function(e){var t=e+(""===e?"hidden":"Hidden")
|
|
108
|
+
void 0===document[t]||r||(r=t,s=e+"visibilitychange")})),(0,t.updateHiddenProperty)(r),document.addEventListener(s,(function(){(0,t.resetTitleCount)()}),!1),e.register("events:main",Ember.Object.extend(Ember.Evented).create(),{instantiate:!1}),a.forEach((function(t){return e.inject(t,"events","events:main")}))
|
|
109
|
+
var o=/mobile/i.test(navigator.userAgent)&&!/iPad/.test(navigator.userAgent)
|
|
110
|
+
o&&document.body.classList.add("mobile"),e.register("site:main",{isMobile:o},{instantiate:!1}),e.inject("controller","site","site:main")}var s={initialize:r}
|
|
111
|
+
e.default=s})),define("client-app/initializers/app-version",["exports","ember-cli-app-version/initializer-factory","client-app/config/environment"],(function(e,t,n){var a,r
|
|
111
112
|
Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,n.default.APP&&(a=n.default.APP.name,r=n.default.APP.version)
|
|
112
113
|
var s={name:"App Version",initialize:(0,t.default)(a,r)}
|
|
113
114
|
e.default=s})),define("client-app/initializers/container-debug-adapter",["exports","ember-resolver/resolvers/classic/container-debug-adapter"],(function(e,t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
|
|
@@ -127,31 +128,29 @@ e.default=a})),define("client-app/instance-initializers/ember-data",["exports","
|
|
|
127
128
|
var n={name:"ember-data",initialize:t.default}
|
|
128
129
|
e.default=n}))
|
|
129
130
|
define("client-app/lib/decorators",["exports"],(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.bound=function(e,t,n){var a=n.value,r="_".concat(t,"Bound")
|
|
130
|
-
return{get:function(){return this[r]?this[r]:(this.set(r,a.bind(this)),this[r])}}}})),define("client-app/lib/preload",["exports"],(function(e){
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
var n=!
|
|
134
|
-
|
|
135
|
-
e.default=r})),define("client-app/lib/utilities",["exports","@babel/runtime/helpers/esm/typeof","client-app/lib/preload"],(function(e,t,n){Object.defineProperty(e,"__esModule",{value:!0}),e.escapeHtml=o,e.ajax=l,e.preloadOrAjax=function(e,t){var a=n.default.get(e.replace(".json",""))
|
|
131
|
+
return{get:function(){return this[r]?this[r]:(this.set(r,a.bind(this)),this[r])}}}})),define("client-app/lib/preload",["exports"],(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.setRootPath=function(e){t=e},e.getRootPath=function(){return t},e.init=r,e.mutatePreload=function(e,t){a||r()
|
|
132
|
+
Em.set(n,e,t)},e.uninitialize=function(){a=!1},e.default=void 0
|
|
133
|
+
var t,n={},a=!1
|
|
134
|
+
function r(){var e=document.getElementById("preloaded-data").dataset;(n=JSON.parse(e.preloaded)).rootPath=t,a=!0}var s={get:function(e){return a||r(),Em.get(n,e)}}
|
|
135
|
+
e.default=s})),define("client-app/lib/utilities",["exports","@babel/runtime/helpers/esm/typeof","client-app/lib/preload"],(function(e,t,n){Object.defineProperty(e,"__esModule",{value:!0}),e.escapeHtml=o,e.ajax=l,e.preloadOrAjax=function(e,t){var a=n.default.get(e.replace(".json",""))
|
|
136
136
|
return a?Ember.RSVP.resolve(a):l(e,t)},e.updateHiddenProperty=function(e){a=e},e.isHidden=u,e.increaseTitleCount=function(e){if(!u())return
|
|
137
|
-
r=r||document.title,s=s||0,s+=e,document.title="".concat(r," (").concat(s,")")},e.resetTitleCount=function(){s=0,document.title=r||document.title},e.formatTime=c,e.buildArrayString=d,e.buildHashString=function e(a,r){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[]
|
|
137
|
+
r=r||document.title,s=s||0,s+=e,document.title="".concat(r," (").concat(s,")")},e.resetTitleCount=function(){s=0,document.title=r||document.title},e.formatTime=c,e.buildArrayString=d,e.buildHashString=function e(a,r){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[]
|
|
138
138
|
if(!a)return""
|
|
139
|
-
var
|
|
139
|
+
var i=[],l=[],u=n.default.get("env_expandable_keys")||[]
|
|
140
140
|
Object.keys(a).forEach((function(e){var n=a[e]
|
|
141
|
-
if(null===n)
|
|
142
|
-
else if(
|
|
143
|
-
|
|
144
|
-
else if("time"===e&&"number"==typeof n){var
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
return"<table class='".concat(f,"'>").concat(l.join("\n"),"</table>")}
|
|
141
|
+
if(null===n)i.push("null")
|
|
142
|
+
else if("[object Array]"===Object.prototype.toString.call(n)){var p=""
|
|
143
|
+
p=-1!==u.indexOf(e)&&!r&&-1===s.indexOf(e)&&n.length>3?"".concat(o(n[0]),', <a class="expand-list" data-key=').concat(e,">").concat(n.length-1," more</a>"):d(n),i.push("<tr><td>".concat(o(e),"</td><td>").concat(p,"</td></tr>"))}else if("object"===(0,t.default)(n))l.push(e)
|
|
144
|
+
else if("time"===e&&"number"==typeof n){var f=moment(n).format(),m=c(n)
|
|
145
|
+
i.push('<tr title="'.concat(f,'"><td>').concat(e,"</td><td>").concat(m,"</td></tr>"))}else i.push("<tr><td>".concat(o(e),"</td><td>").concat(o(n),"</td></tr>"))})),l.length>0&&l.forEach((function(t){var n=a[t]
|
|
146
|
+
i.push("<tr><td></td><td><table>"),i.push("<td>".concat(o(t),"</td><td>").concat(e(n,!0),"</td>")),i.push("</table></td></tr>")}))
|
|
147
|
+
var p=r?"":"env-table"
|
|
148
|
+
return"<table class='".concat(p,"'>").concat(i.join("\n"),"</table>")},e.clone=function(e){var t={}
|
|
149
|
+
return Object.keys(e).forEach((function(n){t[n]=e[n]})),t}
|
|
151
150
|
var a,r,s,i={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}
|
|
152
151
|
function o(e){return String(e).replace(/[&<>"'/]/g,(function(e){return i[e]}))}function l(e,t){return new Ember.RSVP.Promise((function(a,r){t=t||{}
|
|
153
152
|
var s=new XMLHttpRequest
|
|
154
|
-
if(e=n.
|
|
153
|
+
if(e=(0,n.getRootPath)()+e,t.data)for(var i in t.data){var o=-1===e.indexOf("?")?"?":"&"
|
|
155
154
|
e+=o,e+="".concat(i,"=").concat(encodeURIComponent(t.data[i]))}if(s.open(t.method||t.type||"GET",e),s.setRequestHeader("X-SILENCE-LOGGER",!0),t.headers)for(var l in t.headers)s.setRequestHeader(l,t.headers[l])
|
|
156
155
|
s.onreadystatechange=function(){if(4===s.readyState){var e=s.status
|
|
157
156
|
if(e>=200&&e<300||304===e){var t=s.getResponseHeader("Content-Type"),n=s.responseText;/\bjson\b/.test(t)&&(n=JSON.parse(n)),a(n)}else r(s)}},s.send()}))}function u(){return void 0!==a?document[a]:!document.hasFocus}function c(e){var t=moment(e),n=moment()
|
|
@@ -168,7 +167,9 @@ n&&n.set("selected",!1),e.set("selected",!0)
|
|
|
168
167
|
var a=t.messageIndex||0,r=a===this.currentGroupedMessagesPosition
|
|
169
168
|
this.setProperties({currentRow:e,loadingEnv:!1,currentGroupedMessagesPosition:a,currentEnvPosition:0}),r&&this.notifyPropertyChange("currentGroupedMessagesPosition")
|
|
170
169
|
var s=this.currentMessage&&!this.currentMessage.env
|
|
171
|
-
this.fetchEnv({force:s})},tabChanged:function(e){this.setProperties({currentTab:e,loadingEnv:!1}),this.fetchEnv()},groupedMessageChanged:function(e){this.setProperties({currentGroupedMessagesPosition:e,currentEnvPosition:0})
|
|
170
|
+
this.fetchEnv({force:s})},tabChanged:function(e){this.setProperties({currentTab:e,loadingEnv:!1}),this.fetchEnv()},groupedMessageChanged:function(e){this.setProperties({currentGroupedMessagesPosition:e,currentEnvPosition:0})
|
|
171
|
+
var t=this.currentMessage&&!this.currentMessage.env
|
|
172
|
+
this.fetchEnv({force:t})},envChanged:function(e){this.set("currentEnvPosition",e),this.fetchEnv()},fetchEnv:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=this.currentMessage
|
|
172
173
|
if(t.force||n&&!n.env&&"env"===this.currentTab)return this.set("loadingEnv",!0),n.fetchEnv().finally((function(){return e.set("loadingEnv",!1)}))},findEquivalentMessageIndex:function(e){var t=0
|
|
173
174
|
return e&&e.group&&this.currentRow&&this.currentRow.group&&e.key===this.currentRow.key&&(t=e.messages.mapBy("key").indexOf(this.currentMessage.key),t=Math.max(0,t)),t},updateSelectedRow:function(){var e=this.get("currentRow.key")
|
|
174
175
|
if(e&&this.rows){var t=this.rows.find((function(t){return t.key===e}))
|
|
@@ -189,7 +190,7 @@ if(e&&e.length>2&&"/"===e[0]){var t=e.match(/\/(.*)\/(.*)/)
|
|
|
189
190
|
if(t&&3===t.length)try{return new RegExp(t[1],t[2])}catch(n){}}return null})),toObjects:function(e){return e.map((function(e){return e.group?a.default.create(e):n.default.create(e)}))}})
|
|
190
191
|
e.default=s})),define("client-app/models/message",["exports","client-app/lib/utilities","client-app/lib/preload"],(function(e,t,n){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
|
|
191
192
|
var a=Em.Object.extend({MAX_LEN:200,fetchEnv:function(){var e=this
|
|
192
|
-
return(0,t.ajax)("/fetch-env/".concat(this.key,".json")).then((function(t){return e.set("env",t)}))},expand:function(){this.set("expanded",!0)},solve:function(){return(0,t.ajax)("/solve/".concat(this.key),{type:"PUT"})},destroy:function(){return(0,t.ajax)("/message/".concat(this.key),{type:"DELETE"})},protect:function(){return this.set("protected",!0),(0,t.ajax)("/protect/".concat(this.key),{type:"PUT"})},unprotect:function(){return this.set("protected",!1),(0,t.ajax)("/unprotect/".concat(this.key),{type:"DELETE"})},showCount:Ember.computed("count",(function(){return this.count>1})),hasMore:Ember.computed("message","expanded",(function(){return!this.expanded&&this.message.length>this.MAX_LEN})),shareUrl:Ember.computed("key",(function(){return"".concat(n.
|
|
193
|
+
return(0,t.ajax)("/fetch-env/".concat(this.key,".json")).then((function(t){return e.set("env",t)}))},expand:function(){this.set("expanded",!0)},solve:function(){return(0,t.ajax)("/solve/".concat(this.key),{type:"PUT"})},destroy:function(){return(0,t.ajax)("/message/".concat(this.key),{type:"DELETE"})},protect:function(){return this.set("protected",!0),(0,t.ajax)("/protect/".concat(this.key),{type:"PUT"})},unprotect:function(){return this.set("protected",!1),(0,t.ajax)("/unprotect/".concat(this.key),{type:"DELETE"})},showCount:Ember.computed("count",(function(){return this.count>1})),hasMore:Ember.computed("message","expanded",(function(){return!this.expanded&&this.message.length>this.MAX_LEN})),shareUrl:Ember.computed("key",(function(){return"".concat((0,n.getRootPath)(),"/show/").concat(this.key)})),displayMessage:Ember.computed("message","expanded",(function(){var e=this.message
|
|
193
194
|
return!this.expanded&&this.message.length>this.MAX_LEN&&(e=this.message.substr(0,this.MAX_LEN)),e})),updateFromObject:function(e){this.set("count",e.get("count"))},canSolve:Ember.computed("env.{application_version,length}",(function(){return(Array.isArray(this.env)?this.env.map((function(e){return e.application_version})).compact().join(""):this.env&&this.env.application_version)&&this.backtrace&&this.backtrace.length>0})),rowClass:Ember.computed("severity",(function(){switch(this.get("severity")){case 0:return"debug"
|
|
194
195
|
case 1:return"info"
|
|
195
196
|
case 2:return"warn"
|
|
@@ -250,4 +251,4 @@ e.default=t})),define("client-app/templates/show",["exports"],(function(e){Objec
|
|
|
250
251
|
var t=Ember.HTMLBars.template({id:"Xt+M1cRV",block:'{"symbols":[],"statements":[[4,"link-to",null,[["route"],["index"]],{"statements":[[0,"Recent"]],"parameters":[]},null],[0,"\\n"],[7,"div",true],[10,"id","bottom-panel"],[10,"class","full"],[8],[0,"\\n "],[1,[28,"message-info",null,[["currentMessage","showTitle","envChangedAction","currentEnvPosition","actionsInMenu"],[[24,["model"]],"true",[28,"action",[[23,0,[]],"envChanged"],null],[24,["envPosition"]],false]]],false],[0,"\\n"],[9],[0,"\\n"]],"hasEval":false}',meta:{moduleName:"client-app/templates/show.hbs"}})
|
|
251
252
|
e.default=t}))
|
|
252
253
|
define("client-app/transforms/boolean",["exports","@ember-data/serializer/-private"],(function(e,t){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t.BooleanTransform}})})),define("client-app/transforms/date",["exports","@ember-data/serializer/-private"],(function(e,t){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t.DateTransform}})})),define("client-app/transforms/number",["exports","@ember-data/serializer/-private"],(function(e,t){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t.NumberTransform}})})),define("client-app/transforms/string",["exports","@ember-data/serializer/-private"],(function(e,t){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t.StringTransform}})})),define("client-app/config/environment",[],(function(){try{var e="client-app/config/environment",t=document.querySelector('meta[name="'+e+'"]').getAttribute("content"),n={default:JSON.parse(decodeURIComponent(t))}
|
|
253
|
-
return Object.defineProperty(n,"__esModule",{value:!0}),n}catch(a){throw new Error('Could not read config from meta tag with name "'+e+'".')}})),runningTests||require("client-app/app").default.create({name:"client-app",version:"
|
|
254
|
+
return Object.defineProperty(n,"__esModule",{value:!0}),n}catch(a){throw new Error('Could not read config from meta tag with name "'+e+'".')}})),runningTests||require("client-app/app").default.create({name:"client-app",version:"0.0.0+3dd1107e"})
|
|
@@ -6,7 +6,7 @@ function startsWith(str, search) {
|
|
|
6
6
|
if (!str || !search || search.length > str.length) {
|
|
7
7
|
return false;
|
|
8
8
|
}
|
|
9
|
-
return str.substring(0, search.length)
|
|
9
|
+
return str.substring(0, search.length) === search;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
function backtraceLinksEnabled() {
|
|
@@ -115,8 +115,10 @@ export default Component.extend({
|
|
|
115
115
|
},
|
|
116
116
|
|
|
117
117
|
findGithubURL(line, shortenedLine) {
|
|
118
|
+
const projectDirs = Preloaded.get("directories") || [];
|
|
118
119
|
const isGem = startsWith(line, Preloaded.get("gems_dir"));
|
|
119
|
-
|
|
120
|
+
const isApp = projectDirs.some(p => startsWith(line, p.path));
|
|
121
|
+
if (isGem || !isApp) {
|
|
120
122
|
return this.GithubURLForGem(shortenedLine);
|
|
121
123
|
} else {
|
|
122
124
|
return this.GithubURLForApp(line);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Component from "@ember/component";
|
|
2
2
|
import { computed } from "@ember/object";
|
|
3
|
-
import { buildHashString } from "client-app/lib/utilities";
|
|
3
|
+
import { buildHashString, clone } from "client-app/lib/utilities";
|
|
4
4
|
import Preload from "client-app/lib/preload";
|
|
5
5
|
|
|
6
6
|
export default Component.extend({
|
|
@@ -20,28 +20,20 @@ export default Component.extend({
|
|
|
20
20
|
if (!this.isEnvArray) {
|
|
21
21
|
return buildHashString(this.get("message.env"));
|
|
22
22
|
} else {
|
|
23
|
+
const currentEnv = clone(this.currentEnv);
|
|
23
24
|
const expandableKeys = Preload.get("env_expandable_keys") || [];
|
|
24
|
-
const expandedLists = {};
|
|
25
25
|
expandableKeys.forEach(key => {
|
|
26
|
-
if (
|
|
27
|
-
|
|
28
|
-
!Array.isArray(this.currentEnv[key])
|
|
29
|
-
) {
|
|
30
|
-
const list = [this.currentEnv[key]];
|
|
26
|
+
if (currentEnv.hasOwnProperty(key) && !Array.isArray(currentEnv[key])) {
|
|
27
|
+
const list = [currentEnv[key]];
|
|
31
28
|
this.message.env.forEach(env => {
|
|
32
29
|
if (env[key] && list.indexOf(env[key]) === -1) {
|
|
33
30
|
list.push(env[key]);
|
|
34
31
|
}
|
|
35
32
|
});
|
|
36
|
-
|
|
33
|
+
currentEnv[key] = list.length > 1 ? list : list[0];
|
|
37
34
|
}
|
|
38
35
|
});
|
|
39
|
-
return buildHashString(
|
|
40
|
-
this.currentEnv,
|
|
41
|
-
false,
|
|
42
|
-
this.expanded,
|
|
43
|
-
expandedLists
|
|
44
|
-
);
|
|
36
|
+
return buildHashString(currentEnv, false, this.expanded || []);
|
|
45
37
|
}
|
|
46
38
|
}),
|
|
47
39
|
|
|
@@ -18,6 +18,9 @@ export default Component.extend({
|
|
|
18
18
|
actions: {
|
|
19
19
|
takeStep(dir) {
|
|
20
20
|
const amount = dir === "back" ? -1 : 1;
|
|
21
|
+
if (amount === 1 && this.disableForwardButtons) return;
|
|
22
|
+
if (amount === -1 && this.disableBackButtons) return;
|
|
23
|
+
|
|
21
24
|
const newPos = this.position + amount;
|
|
22
25
|
this.navigate(newPos);
|
|
23
26
|
},
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { helper } from "@ember/component/helper";
|
|
2
|
-
import
|
|
2
|
+
import { getRootPath } from "client-app/lib/preload";
|
|
3
3
|
|
|
4
4
|
export function logsterUrl(arr) {
|
|
5
5
|
let url = arr[0];
|
|
6
6
|
if (url[0] !== "/") {
|
|
7
7
|
url = `/${url}`;
|
|
8
8
|
}
|
|
9
|
-
return
|
|
9
|
+
return getRootPath() + url;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export default helper(logsterUrl);
|
data/client-app/app/index.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<title>ClientApp</title>
|
|
7
7
|
<meta name="description" content="">
|
|
8
8
|
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=yes">
|
|
9
|
-
<meta id="preloaded-data" data-root-path="/logs"
|
|
9
|
+
<meta id="preloaded-data" data-root-path="/logs">
|
|
10
10
|
|
|
11
11
|
{{content-for "head"}}
|
|
12
12
|
|
|
@@ -1,13 +1,28 @@
|
|
|
1
1
|
import {
|
|
2
2
|
updateHiddenProperty,
|
|
3
|
-
resetTitleCount
|
|
3
|
+
resetTitleCount,
|
|
4
|
+
ajax
|
|
4
5
|
} from "client-app/lib/utilities";
|
|
5
6
|
import Evented from "@ember/object/evented";
|
|
6
7
|
import EmberObject from "@ember/object";
|
|
8
|
+
import { setRootPath } from "client-app/lib/preload";
|
|
7
9
|
|
|
8
10
|
const TARGETS = ["component", "route"];
|
|
9
11
|
|
|
10
12
|
export function initialize(app) {
|
|
13
|
+
const config = app.resolveRegistration("config:environment");
|
|
14
|
+
setRootPath(config.rootURL.replace(/\/$/, ""));
|
|
15
|
+
|
|
16
|
+
if (config.environment === "development") {
|
|
17
|
+
app.deferReadiness();
|
|
18
|
+
ajax("/development-preload.json")
|
|
19
|
+
.then(data => {
|
|
20
|
+
const elem = document.getElementById("preloaded-data");
|
|
21
|
+
elem.setAttribute("data-preloaded", JSON.stringify(data));
|
|
22
|
+
})
|
|
23
|
+
.catch(xhr => console.error("Fetching preload data failed.", xhr)) // eslint-disable-line no-console
|
|
24
|
+
.finally(() => app.advanceReadiness());
|
|
25
|
+
}
|
|
11
26
|
// config for moment.js
|
|
12
27
|
moment.updateLocale("en", {
|
|
13
28
|
relativeTime: {
|
|
@@ -1,11 +1,20 @@
|
|
|
1
|
-
let CONTAINER;
|
|
1
|
+
let CONTAINER = {};
|
|
2
2
|
let isInitialized = false;
|
|
3
|
+
let rootPath;
|
|
4
|
+
|
|
5
|
+
export function setRootPath(path) {
|
|
6
|
+
rootPath = path;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function getRootPath() {
|
|
10
|
+
return rootPath;
|
|
11
|
+
}
|
|
3
12
|
|
|
4
13
|
// exported so that it can be used in tests
|
|
5
14
|
export function init() {
|
|
6
15
|
const dataset = document.getElementById("preloaded-data").dataset;
|
|
7
16
|
CONTAINER = JSON.parse(dataset.preloaded);
|
|
8
|
-
CONTAINER.rootPath =
|
|
17
|
+
CONTAINER.rootPath = rootPath;
|
|
9
18
|
isInitialized = true;
|
|
10
19
|
}
|
|
11
20
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Preload from "client-app/lib/preload";
|
|
1
|
+
import { default as Preload, getRootPath } from "client-app/lib/preload";
|
|
2
2
|
import { Promise, resolve } from "rsvp";
|
|
3
3
|
|
|
4
4
|
const entityMap = {
|
|
@@ -18,7 +18,7 @@ export function ajax(url, settings) {
|
|
|
18
18
|
return new Promise((resolve, reject) => {
|
|
19
19
|
settings = settings || {};
|
|
20
20
|
const xhr = new XMLHttpRequest();
|
|
21
|
-
url =
|
|
21
|
+
url = getRootPath() + url;
|
|
22
22
|
if (settings.data) {
|
|
23
23
|
for (let param in settings.data) {
|
|
24
24
|
const prefix = url.indexOf("?") === -1 ? "?" : "&";
|
|
@@ -128,7 +128,7 @@ export function buildArrayString(array) {
|
|
|
128
128
|
return "[" + buffer.join(", ") + "]";
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
export function buildHashString(hash, recurse, expanded = []
|
|
131
|
+
export function buildHashString(hash, recurse, expanded = []) {
|
|
132
132
|
if (!hash) return "";
|
|
133
133
|
|
|
134
134
|
const buffer = [];
|
|
@@ -138,23 +138,21 @@ export function buildHashString(hash, recurse, expanded = [], lists = {}) {
|
|
|
138
138
|
const v = hash[k];
|
|
139
139
|
if (v === null) {
|
|
140
140
|
buffer.push("null");
|
|
141
|
-
} else if (
|
|
141
|
+
} else if (Object.prototype.toString.call(v) === "[object Array]") {
|
|
142
142
|
let valueHtml = "";
|
|
143
|
-
if (
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
143
|
+
if (
|
|
144
|
+
expandableKeys.indexOf(k) !== -1 &&
|
|
145
|
+
!recurse &&
|
|
146
|
+
expanded.indexOf(k) === -1 &&
|
|
147
|
+
v.length > 3
|
|
148
|
+
) {
|
|
149
149
|
valueHtml = `${escapeHtml(
|
|
150
|
-
|
|
151
|
-
)}, <a class="expand-list" data-key=${k}>${
|
|
152
|
-
|
|
150
|
+
v[0]
|
|
151
|
+
)}, <a class="expand-list" data-key=${k}>${v.length - 1} more</a>`;
|
|
152
|
+
} else {
|
|
153
|
+
valueHtml = buildArrayString(v);
|
|
153
154
|
}
|
|
154
155
|
buffer.push(`<tr><td>${escapeHtml(k)}</td><td>${valueHtml}</td></tr>`);
|
|
155
|
-
} else if (Object.prototype.toString.call(v) === "[object Array]") {
|
|
156
|
-
const valueHtml = buildArrayString(v);
|
|
157
|
-
buffer.push(`<tr><td>${escapeHtml(k)}</td><td>${valueHtml}</td></tr>`);
|
|
158
156
|
} else if (typeof v === "object") {
|
|
159
157
|
hashes.push(k);
|
|
160
158
|
} else {
|
|
@@ -170,14 +168,26 @@ export function buildHashString(hash, recurse, expanded = [], lists = {}) {
|
|
|
170
168
|
}
|
|
171
169
|
});
|
|
172
170
|
|
|
173
|
-
hashes.
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
171
|
+
if (hashes.length > 0) {
|
|
172
|
+
hashes.forEach(k1 => {
|
|
173
|
+
const v = hash[k1];
|
|
174
|
+
buffer.push("<tr><td></td><td><table>");
|
|
175
|
+
buffer.push(
|
|
176
|
+
`<td>${escapeHtml(k1)}</td><td>${buildHashString(v, true)}</td>`
|
|
177
|
+
);
|
|
178
|
+
buffer.push("</table></td></tr>");
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
181
|
const className = recurse ? "" : "env-table";
|
|
182
182
|
return `<table class='${className}'>${buffer.join("\n")}</table>`;
|
|
183
183
|
}
|
|
184
|
+
|
|
185
|
+
export function clone(object) {
|
|
186
|
+
// simple function to clone an object
|
|
187
|
+
// we don't need it fancier than this
|
|
188
|
+
const copy = {};
|
|
189
|
+
Object.keys(object).forEach(k => {
|
|
190
|
+
copy[k] = object[k];
|
|
191
|
+
});
|
|
192
|
+
return copy;
|
|
193
|
+
}
|
|
@@ -79,7 +79,8 @@ export default EmberObject.extend({
|
|
|
79
79
|
currentGroupedMessagesPosition: newPosition,
|
|
80
80
|
currentEnvPosition: 0
|
|
81
81
|
});
|
|
82
|
-
this.
|
|
82
|
+
const forceFetchEnv = this.currentMessage && !this.currentMessage.env;
|
|
83
|
+
this.fetchEnv({ force: forceFetchEnv });
|
|
83
84
|
},
|
|
84
85
|
|
|
85
86
|
envChanged(newPosition) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ajax } from "client-app/lib/utilities";
|
|
2
|
-
import
|
|
2
|
+
import { getRootPath } from "client-app/lib/preload";
|
|
3
3
|
import { computed } from "@ember/object";
|
|
4
4
|
|
|
5
5
|
export default Em.Object.extend({
|
|
@@ -42,7 +42,7 @@ export default Em.Object.extend({
|
|
|
42
42
|
}),
|
|
43
43
|
|
|
44
44
|
shareUrl: computed("key", function() {
|
|
45
|
-
return `${
|
|
45
|
+
return `${getRootPath()}/show/${this.key}`;
|
|
46
46
|
}),
|
|
47
47
|
|
|
48
48
|
displayMessage: computed("message", "expanded", function() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# This script takes care of updating the content of the preloaded json in
|
|
4
|
-
# All you need to do is update the
|
|
3
|
+
# This script takes care of updating the content of the preloaded json in tests/index.html
|
|
4
|
+
# All you need to do is update the `tests_index_html` hash and run the script
|
|
5
5
|
|
|
6
6
|
require 'bundler/inline'
|
|
7
7
|
require 'json'
|
|
@@ -36,27 +36,7 @@ tests_index_html = {
|
|
|
36
36
|
application_version: "ce512452b512b909c38e9c63f2a0e1f8c17a2399"
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
backtrace_links_enabled: true,
|
|
44
|
-
gems_data: [],
|
|
45
|
-
directories: [
|
|
46
|
-
{
|
|
47
|
-
path: "/home/sam/Source/discourse",
|
|
48
|
-
url: "https://github.com/discourse/discourse",
|
|
49
|
-
main_app: true
|
|
50
|
-
}
|
|
51
|
-
],
|
|
52
|
-
application_version: "b329e23f8511b7248c0e4aee370a9f8a249e1b84"
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
types = { app: app_index_html, tests: tests_index_html }
|
|
56
|
-
|
|
57
|
-
%i{app tests}.each do |type|
|
|
58
|
-
content = File.read("#{type}/index.html")
|
|
59
|
-
json = CGI.escapeHTML(JSON.generate(types[type]))
|
|
60
|
-
content.sub!(/data-preloaded=".*">$/, "data-preloaded=\"#{json}\">")
|
|
61
|
-
File.write("#{type}/index.html", content)
|
|
62
|
-
end
|
|
39
|
+
content = File.read("tests/index.html")
|
|
40
|
+
json = CGI.escapeHTML(JSON.generate(tests_index_html))
|
|
41
|
+
content.sub!(/data-preloaded=".*">$/, "data-preloaded=\"#{json}\">")
|
|
42
|
+
File.write("tests/index.html", content)
|
|
@@ -18,11 +18,12 @@ module("Integration | Component | back-trace", function(hooks) {
|
|
|
18
18
|
test("backtrace lines display and work correctly", async function(assert) {
|
|
19
19
|
const backtrace = `/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.1/lib/active_record/relation/finder_methods.rb:317:in \`exists?'
|
|
20
20
|
/var/www/discourse/lib/permalink_constraint.rb:6:in \`matches?'
|
|
21
|
-
/var/www/discourse/plugins/discourse-prometheus/lib/middleware/metrics.rb:17:in \`call'
|
|
21
|
+
/var/www/discourse/plugins/discourse-prometheus/lib/middleware/metrics.rb:17:in \`call'
|
|
22
|
+
activerecord-6.0.1/lib/active_record/relation/finder_methods.rb:317:in \`exists?'`;
|
|
22
23
|
this.set("backtrace", backtrace);
|
|
23
24
|
await render(hbs`{{back-trace backtrace=backtrace}}`);
|
|
24
25
|
|
|
25
|
-
const [gem, app, plugin] = findAll("a");
|
|
26
|
+
const [gem, app, plugin, gem2] = findAll("a");
|
|
26
27
|
assert.equal(
|
|
27
28
|
gem.href,
|
|
28
29
|
"https://github.com/rails/rails/tree/v6.0.1/activerecord/lib/active_record/relation/finder_methods.rb#L317"
|
|
@@ -38,6 +39,11 @@ module("Integration | Component | back-trace", function(hooks) {
|
|
|
38
39
|
"https://github.com/discourse/discourse-prometheus/blob/master/lib/middleware/metrics.rb#L17"
|
|
39
40
|
);
|
|
40
41
|
|
|
42
|
+
assert.equal(
|
|
43
|
+
gem2.href,
|
|
44
|
+
"https://github.com/rails/rails/tree/v6.0.1/activerecord/lib/active_record/relation/finder_methods.rb#L317"
|
|
45
|
+
);
|
|
46
|
+
|
|
41
47
|
let gemLine = find("div.backtrace-line");
|
|
42
48
|
assert.equal(
|
|
43
49
|
gemLine.textContent,
|
|
@@ -25,6 +25,10 @@ const message3 = Message.create({
|
|
|
25
25
|
]
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
+
const message4 = Message.create({
|
|
29
|
+
env: { env_key_2: "value", default_expanded: "vvv", notExpanded: "wwww" }
|
|
30
|
+
});
|
|
31
|
+
|
|
28
32
|
function reduceToContent(node) {
|
|
29
33
|
return Array.from(node.childNodes).reduce(
|
|
30
34
|
(ac, cr) => `${ac.textContent}: ${cr.textContent}`
|
|
@@ -164,5 +168,27 @@ module("Integration | Component | env-tab", function(hooks) {
|
|
|
164
168
|
"[value1, value2, value3, value4]",
|
|
165
169
|
"expanded env keys shown correctly"
|
|
166
170
|
);
|
|
171
|
+
|
|
172
|
+
this.setProperties({
|
|
173
|
+
message: message4,
|
|
174
|
+
callback,
|
|
175
|
+
envPosition: 0
|
|
176
|
+
});
|
|
177
|
+
await render(
|
|
178
|
+
hbs`{{env-tab message=message envChangedAction=callback currentEnvPosition=envPosition}}`
|
|
179
|
+
);
|
|
180
|
+
const recreatedEnv = {};
|
|
181
|
+
findAll(".env-table tr").forEach(node => {
|
|
182
|
+
recreatedEnv[
|
|
183
|
+
node.children[0].innerText.trim()
|
|
184
|
+
] = node.children[1].innerText.trim();
|
|
185
|
+
});
|
|
186
|
+
Object.keys(recreatedEnv).forEach(k => {
|
|
187
|
+
assert.equal(
|
|
188
|
+
recreatedEnv[k],
|
|
189
|
+
this.message.env[k],
|
|
190
|
+
`${k}: ${recreatedEnv[k]} === ${this.message.env[k]}`
|
|
191
|
+
);
|
|
192
|
+
});
|
|
167
193
|
});
|
|
168
194
|
});
|
|
@@ -13,7 +13,7 @@ module("Integration | Component | patterns-list", function(hooks) {
|
|
|
13
13
|
patterns: []
|
|
14
14
|
});
|
|
15
15
|
await render(
|
|
16
|
-
hbs`{{patterns-list patterns=patterns mutable=mutable
|
|
16
|
+
hbs`{{patterns-list patterns=patterns mutable=mutable key="suppression"}}`
|
|
17
17
|
);
|
|
18
18
|
assert
|
|
19
19
|
.dom(".pattern-input")
|
|
@@ -104,7 +104,7 @@ module Logster
|
|
|
104
104
|
if json
|
|
105
105
|
[200, { "Content-Type" => "application/json; charset=utf-8" }, [message.to_json]]
|
|
106
106
|
else
|
|
107
|
-
preload =
|
|
107
|
+
preload = { "/show/#{key}" => message }
|
|
108
108
|
[200, { "Content-Type" => "text/html; charset=utf-8" }, [body(preload)]]
|
|
109
109
|
end
|
|
110
110
|
|
|
@@ -130,7 +130,7 @@ module Logster
|
|
|
130
130
|
end
|
|
131
131
|
[200, { "Content-Type" => "application/json; charset=utf-8" }, [JSON.generate(suppression: suppression, grouping: grouping)]]
|
|
132
132
|
else
|
|
133
|
-
[200, { "Content-Type" => "text/html; charset=utf-8" }, [body
|
|
133
|
+
[200, { "Content-Type" => "text/html; charset=utf-8" }, [body]]
|
|
134
134
|
end
|
|
135
135
|
elsif resource =~ /\/patterns\/([a-zA-Z0-9_]+)\.json$/
|
|
136
136
|
unless Logster.config.enable_custom_patterns_via_ui
|
|
@@ -161,7 +161,7 @@ module Logster
|
|
|
161
161
|
Logster.store.remove_ignore_count(pattern)
|
|
162
162
|
[200, {}, ["OK"]]
|
|
163
163
|
elsif resource == "/"
|
|
164
|
-
[200, { "Content-Type" => "text/html; charset=utf-8" }, [body
|
|
164
|
+
[200, { "Content-Type" => "text/html; charset=utf-8" }, [body]]
|
|
165
165
|
elsif resource =~ /\/fetch-env\/([0-9a-f]+)\.json$/
|
|
166
166
|
key = $1
|
|
167
167
|
env = Logster.store.get_env(key)
|
|
@@ -180,6 +180,8 @@ module Logster
|
|
|
180
180
|
return not_found("No such pattern group exists") if !group
|
|
181
181
|
group.messages_keys.each { |k| Logster.store.solve(k) }
|
|
182
182
|
return [200, {}, []]
|
|
183
|
+
elsif resource == '/development-preload.json' && ENV["LOGSTER_ENV"] == "development"
|
|
184
|
+
[200, { "Content-Type" => "application/json; charset=utf-8" }, [JSON.generate(preloaded_data)]]
|
|
183
185
|
else
|
|
184
186
|
not_found
|
|
185
187
|
end
|
|
@@ -308,11 +310,6 @@ module Logster
|
|
|
308
310
|
end
|
|
309
311
|
end
|
|
310
312
|
|
|
311
|
-
def preload_json(extra = {})
|
|
312
|
-
values = {}
|
|
313
|
-
values.merge!(extra)
|
|
314
|
-
end
|
|
315
|
-
|
|
316
313
|
def css(name, attrs = {})
|
|
317
314
|
attrs = attrs.map do |k, v|
|
|
318
315
|
"#{k}='#{v}'"
|
|
@@ -344,14 +341,12 @@ module Logster
|
|
|
344
341
|
}
|
|
345
342
|
end
|
|
346
343
|
|
|
347
|
-
def
|
|
348
|
-
|
|
349
|
-
root_url += "/" if root_url[-1] != "/"
|
|
350
|
-
preload.merge!(
|
|
344
|
+
def preloaded_data
|
|
345
|
+
preload = {
|
|
351
346
|
env_expandable_keys: Logster.config.env_expandable_keys,
|
|
352
347
|
patterns_enabled: Logster.config.enable_custom_patterns_via_ui,
|
|
353
348
|
application_version: Logster.config.application_version
|
|
354
|
-
|
|
349
|
+
}
|
|
355
350
|
backtrace_links_enabled = Logster.config.enable_backtrace_links
|
|
356
351
|
gems_dir = Logster.config.gems_dir
|
|
357
352
|
gems_dir += "/" if gems_dir[-1] != "/"
|
|
@@ -360,6 +355,13 @@ module Logster
|
|
|
360
355
|
if backtrace_links_enabled
|
|
361
356
|
preload.merge!(preload_backtrace_data)
|
|
362
357
|
end
|
|
358
|
+
preload
|
|
359
|
+
end
|
|
360
|
+
|
|
361
|
+
def body(preload = {})
|
|
362
|
+
preload = preloaded_data.merge(preload)
|
|
363
|
+
root_url = @logs_path
|
|
364
|
+
root_url += "/" if root_url[-1] != "/"
|
|
363
365
|
<<~HTML
|
|
364
366
|
<!doctype html>
|
|
365
367
|
<html>
|
|
@@ -374,7 +376,7 @@ module Logster
|
|
|
374
376
|
#{css("client-app.css")}
|
|
375
377
|
#{script("vendor.js")}
|
|
376
378
|
<meta id="preloaded-data" data-root-path="#{@logs_path}" data-preloaded="#{to_json_and_escape(preload)}">
|
|
377
|
-
<meta name="client-app/config/environment" content="%7B%22modulePrefix%22%3A%22client-app%22%2C%22environment%22%3A%22production%22%2C%22rootURL%22%3A%22#{root_url}%22%2C%22locationType%22%3A%22history%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%7D%7D%2C%22APP%22%3A%7B%22name%22%3A%22client-app%22%2C%22version%22%3A%220.0.0
|
|
379
|
+
<meta name="client-app/config/environment" content="%7B%22modulePrefix%22%3A%22client-app%22%2C%22environment%22%3A%22production%22%2C%22rootURL%22%3A%22#{root_url}%22%2C%22locationType%22%3A%22history%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_DEFAULT_ASYNC_OBSERVERS%22%3Atrue%2C%22_JQUERY_INTEGRATION%22%3Afalse%2C%22_TEMPLATE_ONLY_GLIMMER_COMPONENTS%22%3Atrue%7D%2C%22APP%22%3A%7B%22name%22%3A%22client-app%22%2C%22version%22%3A%220.0.0%2B7a424002%22%7D%2C%22exportApplicationGlobal%22%3Afalse%7D" />
|
|
378
380
|
</head>
|
|
379
381
|
<body>
|
|
380
382
|
#{script("client-app.js")}
|
data/lib/logster/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: logster
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.6.
|
|
4
|
+
version: 2.6.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- UI for viewing logs in Rack
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-02-
|
|
11
|
+
date: 2020-02-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -253,7 +253,6 @@ files:
|
|
|
253
253
|
- client-app/tests/test-helper.js
|
|
254
254
|
- client-app/tests/unit/controllers/index-test.js
|
|
255
255
|
- client-app/tests/unit/controllers/show-test.js
|
|
256
|
-
- client-app/tests/unit/initializers/app-init-test.js
|
|
257
256
|
- client-app/tests/unit/routes/index-test.js
|
|
258
257
|
- client-app/tests/unit/routes/show-test.js
|
|
259
258
|
- lib/examples/sidekiq_logster_reporter.rb
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import Application from '@ember/application';
|
|
2
|
-
|
|
3
|
-
import { initialize } from 'client-app/initializers/app-init';
|
|
4
|
-
import { module, test } from 'qunit';
|
|
5
|
-
import { setupTest } from 'ember-qunit';
|
|
6
|
-
import { run } from '@ember/runloop';
|
|
7
|
-
|
|
8
|
-
module('Unit | Initializer | app-init', function(hooks) {
|
|
9
|
-
setupTest(hooks);
|
|
10
|
-
|
|
11
|
-
hooks.beforeEach(function() {
|
|
12
|
-
this.TestApplication = Application.extend();
|
|
13
|
-
this.TestApplication.initializer({
|
|
14
|
-
name: 'initializer under test',
|
|
15
|
-
initialize
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
this.application = this.TestApplication.create({ autoboot: false });
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
hooks.afterEach(function() {
|
|
22
|
-
run(this.application, 'destroy');
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
// Replace this with your real tests.
|
|
26
|
-
test('it works', async function(assert) {
|
|
27
|
-
await this.application.boot();
|
|
28
|
-
|
|
29
|
-
assert.ok(true);
|
|
30
|
-
});
|
|
31
|
-
});
|