@@ -95,12 +95,41 @@ component extends="coldbox.system.RestHandler" {
95
95
* Get the profilers via ajax
96
96
*/
97
97
function renderProfilers ( event , rc , prc ){
98
+ // Sorting: timestamp, executionTime
99
+ event .paramValue ( " sortBy" , " timestamp" )
100
+ .paramValue ( " sortOrder" , " desc" );
101
+
102
+ // Get the profilers
103
+ var aProfilers = variables .debuggerService .getProfilerStorage ();
104
+
105
+ // Sorting?
106
+ switch ( rc .sortBy ){
107
+ case " executionTime" : {
108
+ arraySort ( aProfilers , function ( e1 , e2 ){
109
+ if ( rc .sortOrder == " asc" ){
110
+ return ( arguments .e1 .executionTime < arguments .e2 .executionTime ? - 1 : 1 );
111
+ }
112
+ return ( arguments .e1 .executionTime > arguments .e2 .executionTime ? - 1 : 1 );
113
+ } );
114
+ break ;
115
+ }
116
+ default : {
117
+ arraySort ( aProfilers , function ( e1 , e2 ){
118
+ if ( rc .sortOrder == " asc" ){
119
+ return dateCompare ( arguments .e1 .timestamp , arguments .e2 .timestamp );
120
+ }
121
+ return dateCompare ( arguments .e2 .timestamp , arguments .e1 .timestamp );
122
+ } );
123
+ break ;
124
+ }
125
+ }
126
+
98
127
return renderView (
99
128
view : " main/partials/profilers" ,
100
129
module : " cbdebugger" ,
101
130
args : {
102
131
environment : variables .debuggerService .getEnvironment (),
103
- profilers : variables . debuggerService . getProfilerStorage () ,
132
+ profilers : aProfilers ,
104
133
debuggerConfig : variables .debuggerConfig
105
134
},
106
135
prePostExempt : true
0 commit comments