@@ -6,6 +6,14 @@ var logDumper = (function($, module) {
66 var strDump = new StrDump ( ) ;
77 var hasSubs = false ;
88
9+ var connections = {
10+ /*
11+ requestId : {
12+ groupStack: [ $node, ... ]
13+ }
14+ */
15+ } ;
16+
917 module . UNDEFINED = UNDEFINED ;
1018 module . ABSTRACTION = ABSTRACTION ;
1119
@@ -32,9 +40,6 @@ var logDumper = (function($, module) {
3240 try {
3341 val = atob ( val ) ;
3442 } catch ( e ) {
35- // console.warn('e', e);
36- // console.log('valOrig', valOrig);
37- // console.trace();
3843 val = valOrig ;
3944 }
4045 }
@@ -124,14 +129,10 @@ var logDumper = (function($, module) {
124129 return currentNodes[requestId];
125130 } else
126131 */
127- if ( $ ( "#" + requestId ) . length ) {
128- // found "session"
129- $nodeWrapper = $ ( "#" + requestId )
130- $node = $nodeWrapper . data ( "currentNodeSummary" )
131- ? $nodeWrapper . data ( "currentNodeSummary" )
132- : $nodeWrapper . data ( 'currentNode' ) ;
133- // currentNodes[requestId] = $node;
132+ if ( typeof connections [ requestId ] !== "undefined" ) {
133+ $node = connections [ requestId ] . slice ( - 1 ) [ 0 ] ;
134134 } else {
135+ // create
135136 $nodeWrapper = $ ( ''
136137 + '<div class="panel panel-default working">'
137138 + '<div class="panel-heading" data-toggle="collapse" data-target="#' + requestId + ' > .panel-body.collapse">'
@@ -150,9 +151,8 @@ var logDumper = (function($, module) {
150151 + '</div>'
151152 ) ;
152153 $node = $nodeWrapper . find ( ".debug-content" ) ;
153- $nodeWrapper
154- . attr ( "id" , requestId )
155- . data ( "currentNode" , $node ) ;
154+ connections [ requestId ] = [ $node ] ;
155+ $nodeWrapper . attr ( "id" , requestId ) ;
156156 $ ( "#body" ) . append ( $nodeWrapper ) ;
157157 // currentNodes[requestId] = $node;
158158 }
@@ -257,6 +257,7 @@ var logDumper = (function($, module) {
257257 $container . addClass ( "panel-danger" ) ;
258258 }
259259 }
260+ delete connections [ meta . requestId ] ;
260261 } else if ( method == 'errorNotConsoled' ) {
261262 $node = $container . find ( '.alert.error-summary' ) ;
262263 if ( ! $node . length ) {
@@ -283,7 +284,7 @@ var logDumper = (function($, module) {
283284 $node = $ ( "<div>" ) . addClass ( "m_group" ) ;
284285 $currentNode . append ( $groupHeader ) ;
285286 $currentNode . append ( $node ) ;
286- $container . data ( "currentNode" , $node ) ;
287+ connections [ meta . requestId ] . push ( $node )
287288 } else if ( method == "groupSummary" ) {
288289 // see if priority already exists
289290 var priority = args [ 0 ] ;
@@ -304,23 +305,20 @@ var logDumper = (function($, module) {
304305 . find ( ".debug-header" )
305306 . append ( $node ) ;
306307 }
307- $container . data ( "currentNodeSummary" , $node ) ;
308+ connections [ meta . requestId ] . push ( $node ) ;
308309 } else if ( method == "groupEnd" ) {
309- if ( $currentNode . is ( ".m_groupSummary" ) ) {
310- $container . removeData ( "currentNodeSummary" ) ;
311- return ;
312- }
313- $toggle = $currentNode . prev ( ) ;
314- // console.info('groupEnd', $toggle.text());
315- if ( ! $currentNode . is ( ".debug-content" ) ) {
316- $container . data ( "currentNode" , $currentNode . parent ( ) ) ;
317- }
318- if ( $toggle . hasClass ( "empty" ) && $toggle . hasClass ( "hide-if-empty" ) ) {
319- $toggle . remove ( ) ;
320- $currentNode . remove ( ) ;
321- }
322- if ( $toggle . is ( ":visible" ) ) {
323- $toggle . debugEnhance ( ) ;
310+ if ( connections [ meta . requestId ] . length > 1 ) {
311+ // closing a summary group
312+ connections [ meta . requestId ] . pop ( ) ;
313+ } else {
314+ $toggle = $currentNode . prev ( ) ;
315+ if ( $toggle . hasClass ( "empty" ) && $toggle . hasClass ( "hide-if-empty" ) ) {
316+ $toggle . remove ( ) ;
317+ $currentNode . remove ( ) ;
318+ }
319+ if ( $toggle . is ( ":visible" ) ) {
320+ $toggle . debugEnhance ( ) ;
321+ }
324322 }
325323 } else if ( method == "groupUncollapse" ) {
326324 // console.log('expand');
@@ -335,12 +333,15 @@ var logDumper = (function($, module) {
335333 } ) ;
336334 methodMeta ( $container , args ) ;
337335 } else if ( method === "table" ) {
338- // console.log('table', args[1], args[0]);
339- $ . each ( args [ 2 ] , function ( i , col ) {
340- args [ 2 ] [ i ] = atob ( col ) ;
341- } ) ;
342- $table = this . methodTable ( args [ 0 ] , atob ( args [ 1 ] ) , args [ 2 ] , "m_table table-bordered sortable" ) ;
343- // $table.debugEnhance();
336+ if ( typeof meta . caption !== "undefined" ) {
337+ // v2.1 +
338+ $table = this . methodTable ( args [ 0 ] , meta . caption , meta . columns , "m_table table-bordered sortable" ) ;
339+ } else {
340+ $ . each ( args [ 2 ] , function ( i , col ) {
341+ args [ 2 ] [ i ] = atob ( col ) ;
342+ } ) ;
343+ $table = this . methodTable ( args [ 0 ] , atob ( args [ 1 ] ) , args [ 2 ] , "m_table table-bordered sortable" ) ;
344+ }
344345 $currentNode . append ( $table ) ;
345346 } else if ( method === "trace" ) {
346347 $table = this . methodTable ( args [ 0 ] , "trace" , [ "file" , "line" , "function" ] , "m_trace table-bordered" ) ;
0 commit comments