Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
lmajano committed Apr 21, 2022
2 parents b79c747 + afc399c commit 09ad141
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 18 deletions.
2 changes: 1 addition & 1 deletion box.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name":"ColdBox Debugger",
"author":"Ortus Solutions <[email protected]",
"location":"https://downloads.ortussolutions.com/ortussolutions/coldbox-modules/cbdebugger/@build.version@/[email protected]@.zip",
"version":"3.3.0",
"version":"3.3.1",
"slug":"cbdebugger",
"type":"modules",
"homepage":"https://github.com/coldbox-modules/cbdebugger",
Expand Down
15 changes: 14 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,22 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


----

## [3.3.1] => 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

Expand Down
21 changes: 17 additions & 4 deletions interceptors/RequestCollector.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) ) {
Expand Down
4 changes: 2 additions & 2 deletions models/DebuggerService.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion resources/assets/js/cbdebugger.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
/**
Expand Down
25 changes: 16 additions & 9 deletions resources/assets/js/components/RequestTrackerPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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" );
Expand All @@ -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" },
Expand All @@ -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(){
Expand Down Expand Up @@ -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 => {
Expand Down

0 comments on commit 09ad141

Please sign in to comment.