Skip to content

Commit c72ec92

Browse files
committed
* Ability to export a profiler in json
1 parent c7727d6 commit c72ec92

File tree

5 files changed

+20
-5
lines changed

5 files changed

+20
-5
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2020
* Ability for the custom `timeIt()` functions to accept metdata to store in the execution timer
2121
* New `Slowest` Queries panel for cborm, acf, and qb/quick
2222
* New visualizer total db time as well as request time including percentage of the request time
23+
* Ability to export a profiler in json
2324

2425
### Fixed
2526

handlers/Main.cfc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,19 @@ component extends="coldbox.system.RestHandler" {
156156
* Get a profiler report via ajax
157157
*/
158158
function renderProfilerReport( event, rc, prc ){
159+
var profilerReport = variables.debuggerService.getProfilerById( rc.id );
160+
161+
if ( profilerReport.isEmpty() ) {
162+
return "<h3 class='cbd-text-red cbd-bg-light-red'>Profiler Id: #encodeForHTML( rc.id )# doesn't exist</h3>";
163+
}
164+
159165
return renderView(
160166
view : "main/partials/profilerReport",
161167
module: "cbdebugger",
162168
args : {
163169
debuggerService : variables.debuggerService,
164170
environment : variables.debuggerService.getEnvironment(),
165-
profiler : variables.debuggerService.getProfilerById( rc.id ),
171+
profiler : profilerReport,
166172
debuggerConfig : variables.debuggerConfig,
167173
isVisualizer : rc.isVisualizer
168174
},

resources/assets/sass/cbdebugger.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
padding: 5px 5px;
4040
border: 1px solid #eaeaea;
4141
color: black;
42+
background-color: rgb(221, 216, 216);
4243

4344
&:hover{
4445
border: 1px solid #333333;

views/main/partials/profilerReport.cfm

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@
4646
</svg>
4747
</button>
4848

49+
<a
50+
href="#event.buildLink( 'cbdebugger:exportProfilerReport', { id : args.profiler.id } )#"
51+
target="_blank"
52+
class="pt5 pb5 cbd-button cbd-rounded"
53+
title="Export Profiler to JSON"
54+
><svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M9 19l3 3m0 0l3-3m-3 3V10"></path></svg></a>
55+
4956
<!--- Back to Profilers --->
5057
<button
5158
type="button"

views/main/partials/profilers.cfm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
(ms)
5858
</th>
5959

60-
<th width="50">
60+
<th width="75">
6161
Actions
6262
</th>
6363
</tr>
@@ -234,9 +234,9 @@
234234
<a
235235
href="#event.buildLink( 'cbdebugger:exportProfilerReport', { id : thisProfiler.id } )#"
236236
target="_blank"
237-
>
238-
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M9 19l3 3m0 0l3-3m-3 3V10"></path></svg>
239-
</a>
237+
class="pt5 pb5 cbd-button cbd-rounded"
238+
title="Export Profiler to JSON"
239+
><svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M9 19l3 3m0 0l3-3m-3 3V10"></path></svg></a>
240240
</td>
241241
</tr>
242242
</cfloop>

0 commit comments

Comments
 (0)