From 9934c6f3ebf8498e5df43edd8394cc66e2e9e64d Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 21 Apr 2022 15:42:32 -0500 Subject: [PATCH 1/7] version bump --- box.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/box.json b/box.json index 0c0cea9..90d5657 100644 --- a/box.json +++ b/box.json @@ -2,7 +2,7 @@ "name":"ColdBox Debugger", "author":"Ortus Solutions Date: Thu, 21 Apr 2022 16:49:31 -0500 Subject: [PATCH 2/7] CBDEBUGGER-10 #resolve Executing Event That Uses QB From Interceptor Generates CBDebugger Exception --- interceptors/RequestCollector.cfc | 21 +++++++++++++++++---- models/DebuggerService.cfc | 4 ++-- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/interceptors/RequestCollector.cfc b/interceptors/RequestCollector.cfc index bf59cf8..3864fc7 100755 --- a/interceptors/RequestCollector.cfc +++ b/interceptors/RequestCollector.cfc @@ -19,14 +19,27 @@ component extends="coldbox.system.Interceptor" { } /** - * Listen to request captures + * Init the request tracking */ - function onRequestCapture( event, interceptData, rc, prc ){ + private function initRequestTracker( event ){ // The timer hashes are stored here for the request and then destroyed - request.$timerHashes = {}; - + param request$timerHashes = {}; // init tracker variables for the request variables.debuggerService.createRequestTracker( event ); + } + + /** + * Listen to app loads, in case we need to profile app inits and such + */ + function cbLoadInterceptorHelpers( event, interceptData, rc, prc ){ + initRequestTracker( event ); + } + + /** + * Listen to request captures + */ + function onRequestCapture( event, interceptData, rc, prc ){ + initRequestTracker( event ); // Determine if we are turning the debugger on/off if ( structKeyExists( rc, "debugMode" ) AND isBoolean( rc.debugMode ) ) { diff --git a/models/DebuggerService.cfc b/models/DebuggerService.cfc index 6e34a19..a6dd2c6 100755 --- a/models/DebuggerService.cfc +++ b/models/DebuggerService.cfc @@ -184,9 +184,9 @@ component */ struct function createRequestTracker( required event ){ // Init the request tracers - request.tracers = []; + param request.tracers = []; // Init the request debugger tracking - request.cbDebugger = { + param request.cbDebugger = { "coldbox" : {}, "exception" : {}, "executionTime" : 0, From 01217410fa4c841b25a448f1f9332e19bddd7117 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 21 Apr 2022 17:01:49 -0500 Subject: [PATCH 3/7] CBDEBUGGER-16 #resolve Left double hash on no state for request tracker profiler CBDEBUGGER-15 #resolve Auto-Refresh is not working in latest version CBDEBUGGER-6 #resolve Stop auto-refresh when visiting a actual request report --- .../assets/js/components/RequestTrackerPanel.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/resources/assets/js/components/RequestTrackerPanel.js b/resources/assets/js/components/RequestTrackerPanel.js index 4829ad2..09bda6b 100644 --- a/resources/assets/js/components/RequestTrackerPanel.js +++ b/resources/assets/js/components/RequestTrackerPanel.js @@ -5,6 +5,7 @@ export default ( isExpanded, refreshFrequency, hasReinitPassword, isVisualizer ) usingReinitPassword : hasReinitPassword, isVisualizer : isVisualizer, currentProfileId : "", + refreshMonitor : null, reinitFramework(){ this.$refs.reinitLoader.classList.add( "cbd-spinner" ); @@ -21,6 +22,7 @@ export default ( isExpanded, refreshFrequency, hasReinitPassword, isVisualizer ) } ); }, loadProfilerReport( id ){ + this.stopDebuggerMonitor(); fetch( `${this.appUrl}cbDebugger/renderProfilerReport`, { method : "POST", headers : { "x-Requested-With": "XMLHttpRequest" }, @@ -31,13 +33,13 @@ export default ( isExpanded, refreshFrequency, hasReinitPassword, isVisualizer ) } ) .then( response => response.text() ) .then( html => { - history.pushState( { profileId: id }, null, "##" + id ); + history.pushState( { profileId: id }, null, "#" + id ); this.$refs[ "cbd-profilers" ].innerHTML = html; coldboxDebugger.scrollTo( "cbd-request-tracker" ); } ); }, clearState(){ - history.pushState( {}, null, "##" ); + history.pushState( {}, null, "#" ); this.currentProfileId = ""; }, refreshProfilers(){ @@ -65,17 +67,18 @@ export default ( isExpanded, refreshFrequency, hasReinitPassword, isVisualizer ) } ); }, stopDebuggerMonitor(){ - if ( "cbdRefreshMonitor" in window ){ - clearInterval( window.cbdRefreshMonitor ); - console.log( "Stopped ColdBox Debugger Profiler Refresh" ); + if ( "refreshMonitor" in this ){ + clearInterval( this.refreshMonitor ); + this.refreshFrequency = 0; + console.info( "Stopped ColdBox Debugger Profiler Refresh" ); } }, startDebuggerMonitor( frequency ){ if ( frequency == 0 ){ return this.stopDebuggerMonitor(); } - window.cbdRefreshMonitor = setInterval( this.refreshProfilers, frequency * 1000 ); - console.log( "Started ColdBox Debugger Profiler Refresh using " + frequency + " seconds" ); + this.refreshMonitor = setInterval( () => this.refreshProfilers(), frequency * 1000 ); + console.info( "Started ColdBox Debugger Profiler Refresh using " + frequency + " seconds" ); }, init(){ window.addEventListener( "popstate", e => { From 7a92edc906ccb0c956b92d45fabb1f6fa3792c25 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 21 Apr 2022 17:11:41 -0500 Subject: [PATCH 4/7] CBDEBUGGER-6 make sure it's only stopped if not null --- resources/assets/js/components/RequestTrackerPanel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/assets/js/components/RequestTrackerPanel.js b/resources/assets/js/components/RequestTrackerPanel.js index 09bda6b..d3df8b9 100644 --- a/resources/assets/js/components/RequestTrackerPanel.js +++ b/resources/assets/js/components/RequestTrackerPanel.js @@ -67,7 +67,7 @@ export default ( isExpanded, refreshFrequency, hasReinitPassword, isVisualizer ) } ); }, stopDebuggerMonitor(){ - if ( "refreshMonitor" in this ){ + if ( this.refreshMonitor != null ){ clearInterval( this.refreshMonitor ); this.refreshFrequency = 0; console.info( "Stopped ColdBox Debugger Profiler Refresh" ); From 5921e089b2636d7f5eaf123f87d922ebb2a782c2 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 21 Apr 2022 17:18:43 -0500 Subject: [PATCH 5/7] CBDEBUGGER-17 more fixes on monitor --- .../assets/js/components/RequestTrackerPanel.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/resources/assets/js/components/RequestTrackerPanel.js b/resources/assets/js/components/RequestTrackerPanel.js index d3df8b9..2a54942 100644 --- a/resources/assets/js/components/RequestTrackerPanel.js +++ b/resources/assets/js/components/RequestTrackerPanel.js @@ -67,6 +67,7 @@ export default ( isExpanded, refreshFrequency, hasReinitPassword, isVisualizer ) } ); }, stopDebuggerMonitor(){ + // stop only if loaded if ( this.refreshMonitor != null ){ clearInterval( this.refreshMonitor ); this.refreshFrequency = 0; @@ -74,11 +75,14 @@ export default ( isExpanded, refreshFrequency, hasReinitPassword, isVisualizer ) } }, startDebuggerMonitor( frequency ){ - if ( frequency == 0 ){ - return this.stopDebuggerMonitor(); + // Ensure monitor is stopped just in case we are switching frequencies + this.stopDebuggerMonitor(); + this.refreshFrequency = frequency; + if ( this.refreshFrequency == 0 ){ + return; } - this.refreshMonitor = setInterval( () => this.refreshProfilers(), frequency * 1000 ); - console.info( "Started ColdBox Debugger Profiler Refresh using " + frequency + " seconds" ); + this.refreshMonitor = setInterval( () => this.refreshProfilers(), this.refreshFrequency * 1000 ); + console.info( "Started ColdBox Debugger Profiler Refresh using " + this.refreshFrequency + " seconds" ); }, init(){ window.addEventListener( "popstate", e => { From 914b2ab8564d13c194d7723820fdfc0ed4a63ed8 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 21 Apr 2022 17:20:25 -0500 Subject: [PATCH 6/7] finalized patch --- box.json | 2 +- changelog.md | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/box.json b/box.json index 90d5657..284fbf4 100644 --- a/box.json +++ b/box.json @@ -2,7 +2,7 @@ "name":"ColdBox Debugger", "author":"Ortus Solutions 2022-APR-21 + +### Fixed + +* [CBDEBUGGER-17](https://ortussolutions.atlassian.net/browse/CBDEBUGGER-17) If you change the monitor frequency, it does not clear the old monitor and you get n monitors +* [CBDEBUGGER-16](https://ortussolutions.atlassian.net/browse/CBDEBUGGER-16) Left double hash on no state for request tracker profiler +* [CBDEBUGGER-15](https://ortussolutions.atlassian.net/browse/CBDEBUGGER-15) Auto-Refresh is not working in latest version +* [CBDEBUGGER-10](https://ortussolutions.atlassian.net/browse/CBDEBUGGER-10) Executing Event That Uses QB From Interceptor Generates CBDebugger Exception +* [CBDEBUGGER-6](https://ortussolutions.atlassian.net/browse/CBDEBUGGER-6) Stop auto-refresh when visiting a actual request report + ---- -## [3.3.0] => 2022 +## [3.3.0] => 2022-APR-21 ### Added From afc399c2270b45ce7c755f49a2a65d59b530e45a Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 21 Apr 2022 17:38:15 -0500 Subject: [PATCH 7/7] CBDEBUGGER-18 #resolve donot override the window on load event, just attach yourself --- resources/assets/js/cbdebugger.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/resources/assets/js/cbdebugger.js b/resources/assets/js/cbdebugger.js index 9170e83..9d9c51d 100644 --- a/resources/assets/js/cbdebugger.js +++ b/resources/assets/js/cbdebugger.js @@ -25,7 +25,9 @@ window.coldboxDebugger = ( () => { /** * Listen to dom load and attach */ - window.onload = ()=> console.log( "ColdBox Debugger Loaded!" ); + window.addEventListener( "load", ( event ) => { + console.log( "ColdBox Debugger Loaded!" ); + } ); return { /**