105
105
html . push ( '<span class="glyphicon glyphicon-fire"></span> ' ) ;
106
106
} else if ( ! item . isMethod ) {
107
107
if ( item . method === "SQL" ) {
108
- html . push ( '<button type="button" class="btn btn-default btn-xs btn-success sql" style="padding:0px 2px 0px 2px"><span class="glyphicon glyphicon-eye-open sql"></span></button> ' ) ;
108
+ html . push ( '<button type="button" class="btn btn-default btn-xs btn-success sql" style="padding:0px 2px 0px 2px"><span class="glyphicon glyphicon-eye-open sql"></span></button> ' ) ;
109
+ } else if ( item . method === "MONGO-JSON" ) {
110
+ html . push ( '<button type="button" class="btn btn-default btn-xs btn-success json" style="padding:0px 2px 0px 2px"><span class="glyphicon glyphicon-eye-open json"></span></button> ' ) ;
109
111
} else {
110
112
html . push ( '<span class="glyphicon glyphicon-info-sign"></span> ' ) ;
111
113
}
340
342
grid = new Slick . Grid ( element . get ( 0 ) , dataView , columns , options ) ;
341
343
grid . setSelectionModel ( new Slick . RowSelectionModel ( ) ) ;
342
344
343
- var isSingleClick = true , clickTimeout = false ;
345
+ var isSingleSQ = true , clickTimeout = false ;
344
346
grid . onClick . subscribe ( function ( e , args ) {
345
347
var item ;
346
348
if ( $ ( e . target ) . hasClass ( "toggle" ) ) {
393
395
) . end ( ) . modal ( "show" ) ;
394
396
}
395
397
}
398
+ if ( $ ( e . target ) . hasClass ( "json" ) ) {
399
+ item = dataView . getItem ( args . row ) ;
400
+ var itemNext = dataView . getItem ( args . row + 1 ) ;
401
+ var data = "json=" + encodeURIComponent ( item . argument ) ;
402
+
403
+ if ( item . isAuthorized ) {
404
+ if ( angular . isDefined ( itemNext ) && itemNext . method === "MONGO-JSON-BindValue" ) {
405
+ data += "&bind=" + encodeURIComponent ( itemNext . argument ) ;
406
+ CommonAjaxService . getSQLBind ( "jsonBind.pinpoint" , data , function ( result ) {
407
+ $ ( "#customLogPopup" ) . find ( "h4" ) . html ( "JSON" ) . end ( ) . find ( "div.modal-body" ) . html (
408
+ '<h4>Binded JSON <button class="btn btn-default btn-xs json">Copy</button></h4>' +
409
+ '<div style="position:absolute;left:10000px">' + result + '</div>' +
410
+ '<pre class="prettyprint lang-json" style="margin-top:0px">' + result . replace ( / \t \t / g, "" ) + '</pre>' +
411
+ '<hr>' +
412
+ '<h4>Original JSON <button class="btn btn-default btn-xs sql">Copy</button></h4>' +
413
+ '<div style="position:absolute;left:10000px">' + item . argument + '</div>' +
414
+ '<pre class="prettyprint lang-json" style="margin-top:0px">' + item . argument . replace ( / \t \t / g, "" ) + '</pre>' +
415
+ '<h4>JSON Bind Value <button class="btn btn-default btn-xs json">Copy</button></h4>' +
416
+ '<div style="position:absolute;left:10000px">' + itemNext . argument + '</div>' +
417
+ '<pre class="prettyprint lang-json" style="margin-top:0px">' + itemNext . argument + '</pre>'
418
+ ) . end ( ) . modal ( "show" ) ;
419
+ prettyPrint ( ) ;
420
+ } ) ;
421
+ } else {
422
+ $ ( "#customLogPopup" ) . find ( "h4" ) . html ( "JSON" ) . end ( ) . find ( "div.modal-body" ) . html (
423
+ '<h4>Original JSON <button class="btn btn-default btn-xs json">Copy</button></h4>' +
424
+ '<div style="position:absolute;left:10000px">' + item . argument + '</div>' +
425
+ '<pre class="prettyprint lang-json" style="margin-top:0px">' + item . argument . replace ( / \t \t / g, "" ) + '</pre>'
426
+ ) . end ( ) . modal ( "show" ) ;
427
+ prettyPrint ( ) ;
428
+ }
429
+ } else {
430
+ $ ( "#customLogPopup" ) . find ( "h4" ) . html ( "JSON" ) . end ( ) . find ( "div.modal-body" ) . html (
431
+ '<h4>Original JSON</h4>' +
432
+ '<div style="margin-top:0px;padding:6px 10px;border-radius:4px;background-color:#C56A6A;color:#D7FBBA;">' + item . argument . replace ( / \t \t / g, "" ) + '</div>'
433
+ ) . end ( ) . modal ( "show" ) ;
434
+ }
435
+ }
396
436
397
437
if ( ! clickTimeout ) {
398
438
clickTimeout = $timeout ( function ( ) {
582
622
grid . scrollRowIntoView ( row , true ) ;
583
623
} ;
584
624
}
585
- } ;
625
+ }
586
626
}
587
627
] ) ;
588
628
} ) ( ) ;
0 commit comments