Skip to content

Commit 92f7e75

Browse files
committed
[#4849] Update popup for mongo plugin.
1 parent dc35e1e commit 92f7e75

File tree

1 file changed

+43
-3
lines changed

1 file changed

+43
-3
lines changed

web/src/main/webapp/features/distributedCallFlow/distributed-call-flow.directive.js

+43-3
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@
105105
html.push('<span class="glyphicon glyphicon-fire"></span>&nbsp;');
106106
} else if (!item.isMethod) {
107107
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>&nbsp;');
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>&nbsp;');
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>&nbsp;');
109111
} else {
110112
html.push('<span class="glyphicon glyphicon-info-sign"></span>&nbsp;');
111113
}
@@ -340,7 +342,7 @@
340342
grid = new Slick.Grid(element.get(0), dataView, columns, options);
341343
grid.setSelectionModel(new Slick.RowSelectionModel());
342344

343-
var isSingleClick = true, clickTimeout = false;
345+
var isSingleSQ = true, clickTimeout = false;
344346
grid.onClick.subscribe(function (e, args) {
345347
var item;
346348
if ($(e.target).hasClass("toggle")) {
@@ -393,6 +395,44 @@
393395
).end().modal("show");
394396
}
395397
}
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+
}
396436

397437
if (!clickTimeout) {
398438
clickTimeout = $timeout(function () {
@@ -582,7 +622,7 @@
582622
grid.scrollRowIntoView( row, true );
583623
};
584624
}
585-
};
625+
}
586626
}
587627
]);
588628
})();

0 commit comments

Comments
 (0)