|
19 | 19 | },
|
20 | 20 | isTimelineView(){
|
21 | 21 | return this.queryView == 'timeline'
|
| 22 | + }, |
| 23 | + isSlowestView(){ |
| 24 | + return this.queryView == 'slowest' |
22 | 25 | }
|
23 | 26 | }"
|
24 | 27 | >
|
|
77 | 80 |
|
78 | 81 | <!--- ToolBar --->
|
79 | 82 | <div class="p10">
|
| 83 | + <!--- Grouped ---> |
80 | 84 | <button
|
81 | 85 | :class="{ 'cbd-selected' : isGroupView() }"
|
82 | 86 | @click="queryView='grouped'"
|
|
86 | 90 | </svg>
|
87 | 91 | Grouped
|
88 | 92 | </button>
|
| 93 | + <!--- Timeline ---> |
89 | 94 | <button
|
90 | 95 | :class="{ 'cbd-selected' : isTimelineView() }"
|
91 | 96 | @click="queryView='timeline'"
|
|
95 | 100 | </svg>
|
96 | 101 | Timeline
|
97 | 102 | </button>
|
| 103 | + <!--- Slowest ---> |
| 104 | + <button |
| 105 | + :class="{ 'cbd-selected' : isSlowestView() }" |
| 106 | + @click="queryView='slowest'" |
| 107 | + > |
| 108 | + <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="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg> |
| 109 | + Slowest |
| 110 | + </button> |
98 | 111 | </div>
|
99 | 112 |
|
100 | 113 | <!--- Query Views --->
|
|
237 | 250 | x-show="isTimelineView"
|
238 | 251 | x-transition
|
239 | 252 | >
|
240 |
| - <table |
241 |
| - border="0" |
242 |
| - align="center" |
243 |
| - cellpadding="0" |
244 |
| - cellspacing="1" |
245 |
| - class="cbd-tables"> |
246 |
| - <thead> |
247 |
| - <tr> |
248 |
| - <th width="125" align="center">Timestamp</th> |
249 |
| - <th width="100" align="center">Execution Time</th> |
250 |
| - <th width="100" align="center">Datasource</th> |
251 |
| - <th>Query</th> |
252 |
| - </tr> |
253 |
| - </thead> |
254 |
| - <tbody> |
255 |
| - <cfloop query="#args.profiler.cfQueries.all#"> |
256 |
| - <cfset q = args.profiler.cfQueries.all> |
257 |
| - <cfif q.type neq "SqlQuery"> |
258 |
| - <cfcontinue> |
259 |
| - </cfif> |
260 |
| - <cfset rowId = createUUID()> |
261 |
| - <tr> |
262 |
| - <td align="center"> |
263 |
| - #TimeFormat( q.timestamp,"hh:MM:SS.l tt" )# |
264 |
| - </td> |
265 |
| - |
266 |
| - <td align="center"> |
267 |
| - #numberFormat( ( q.endTime - q.startTime ) )# ms |
268 |
| - </td> |
269 |
| - |
270 |
| - <td align="center"> |
271 |
| - #q.datasource# |
272 |
| - </td> |
273 |
| - |
274 |
| - <td> |
275 |
| - <cfif q.template.len()> |
276 |
| - <div class="mb10 mt10 cbd-params"> |
277 |
| - <!--- Title ---> |
278 |
| - <strong>Called From: </strong> |
279 |
| - <!--- Open in Editor---> |
280 |
| - <cfif args.debuggerService.openInEditorURL( event, q.stackTrace[ 1 ][ 1 ] ) NEQ ""> |
281 |
| - <div class="cbd-floatRight"> |
282 |
| - <a |
283 |
| - class="cbd-button" |
284 |
| - target="_self" |
285 |
| - rel ="noreferrer noopener" |
286 |
| - title="Open in Editor" |
287 |
| - href="#args.debuggerService.openInEditorURL( event, q.stackTrace[ 1 ][ 1 ] )#" |
288 |
| - > |
289 |
| - <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"> |
290 |
| - <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4" /> |
291 |
| - </svg> |
292 |
| - </a> |
293 |
| - </div> |
294 |
| - </cfif> |
295 |
| - <!--- Line ---> |
296 |
| - <div> |
297 |
| - <strong> |
298 |
| - #replaceNoCase( q.template, appPath, "" )#:#q.line# |
299 |
| - </strong> |
300 |
| - </div> |
301 |
| - </div> |
302 |
| - </cfif> |
303 |
| - |
304 |
| - <!--- Sql Code ---> |
305 |
| - <code id="acfSql-timelinesql-#rowId#"> |
306 |
| - <svg |
307 |
| - xmlns="http://www.w3.org/2000/svg" |
308 |
| - class="h-6 w-6 cbd-floatRight cbd-text-pre mt5" |
309 |
| - fill="none" |
310 |
| - viewBox="0 0 24 24" |
311 |
| - stroke="currentColor" |
312 |
| - title="Copy SQL to Clipboard" |
313 |
| - style="width: 50px; height: 50px; cursor: pointer;" |
314 |
| - onclick="coldboxDebugger.copyToClipboard( 'acfSql-timelinesql-#rowId#' )" |
315 |
| - > |
316 |
| - <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2" /> |
317 |
| - </svg> |
318 |
| - <pre>#sqlFormatter.format( q.body )#</pre> |
319 |
| - </code> |
| 253 | + #renderView( |
| 254 | + view : "main/panels/requestTracker/acfSqlTable", |
| 255 | + module : "cbdebugger", |
| 256 | + args : { |
| 257 | + sqlData : args.profiler.cfQueries.all, |
| 258 | + debuggerService : args.debuggerService, |
| 259 | + sqlFormatter : sqlFormatter, |
| 260 | + jsonFormatter : jsonFormatter, |
| 261 | + appPath : appPath |
| 262 | + }, |
| 263 | + prePostExempt : true |
| 264 | + )# |
| 265 | + </div> |
320 | 266 |
|
321 |
| - <!--- Params ---> |
322 |
| - <cfif NOT q.attributes.isEmpty()> |
323 |
| - <div class="mt10 mb5 cbd-params"> |
324 |
| - <div class="mb10"> |
325 |
| - <strong>Params: </strong> |
326 |
| - </div> |
327 |
| - <code id="acfSql-timelinesql-params-#rowId#"> |
328 |
| - <svg |
329 |
| - xmlns="http://www.w3.org/2000/svg" |
330 |
| - class="h-6 w-6 cbd-floatRight cbd-text-pre mt5" |
331 |
| - fill="none" |
332 |
| - viewBox="0 0 24 24" |
333 |
| - stroke="currentColor" |
334 |
| - title="Copy SQL to Clipboard" |
335 |
| - style="width: 50px; height: 50px; cursor: pointer;" |
336 |
| - onclick="coldboxDebugger.copyToClipboard( 'acfSql-timelinesql-params-#rowId#' )" |
337 |
| - > |
338 |
| - <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2" /> |
339 |
| - </svg> |
340 |
| - <pre>#jsonFormatter.formatJSON( json : q.attributes, spaceAfterColon : true )#</pre> |
341 |
| - </code> |
342 |
| - </div> |
343 |
| - </cfif> |
344 |
| - </td> |
345 |
| - </tr> |
346 |
| - </cfloop> |
347 |
| - </tbody> |
348 |
| - </table> |
| 267 | + <!--- Slowest Queries ---> |
| 268 | + <div |
| 269 | + x-show="isSlowestView" |
| 270 | + x-transition |
| 271 | + > |
| 272 | + #renderView( |
| 273 | + view : "main/panels/requestTracker/acfSqlTable", |
| 274 | + module : "cbdebugger", |
| 275 | + args : { |
| 276 | + sqlData : args.profiler.cfQueries.all.sort( function( a, b ){ |
| 277 | + var executionTimeA = a.endTime - a.startTime; |
| 278 | + var executionTimeB = b.endTime - b.startTime; |
| 279 | + return executionTimeA < executionTimeB ? 1 : -1; |
| 280 | + } ), |
| 281 | + debuggerService : args.debuggerService, |
| 282 | + sqlFormatter : sqlFormatter, |
| 283 | + jsonFormatter : jsonFormatter, |
| 284 | + appPath : appPath |
| 285 | + }, |
| 286 | + prePostExempt : true |
| 287 | + )# |
349 | 288 | </div>
|
350 | 289 | </cfif>
|
351 | 290 | </div>
|
|
0 commit comments