diff --git a/box.json b/box.json index 0c0cea9..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 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, 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 { /** diff --git a/resources/assets/js/components/RequestTrackerPanel.js b/resources/assets/js/components/RequestTrackerPanel.js index 4829ad2..2a54942 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,22 @@ export default ( isExpanded, refreshFrequency, hasReinitPassword, isVisualizer ) } ); }, stopDebuggerMonitor(){ - if ( "cbdRefreshMonitor" in window ){ - clearInterval( window.cbdRefreshMonitor ); - console.log( "Stopped ColdBox Debugger Profiler Refresh" ); + // stop only if loaded + if ( this.refreshMonitor != null ){ + clearInterval( this.refreshMonitor ); + this.refreshFrequency = 0; + console.info( "Stopped ColdBox Debugger Profiler Refresh" ); } }, 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; } - window.cbdRefreshMonitor = setInterval( this.refreshProfilers, frequency * 1000 ); - console.log( "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 => {