|
|
@@ -15,6 +15,7 @@ var logList = [];
|
|
|
*/
|
|
|
function getLogList(count, page, keyword, fromDate, endDate) {
|
|
|
$('#loadingDiv').show();
|
|
|
+ $("#logList-body").empty();
|
|
|
logList = [];
|
|
|
$.get('log/errPage', {
|
|
|
count: count,
|
|
|
@@ -39,7 +40,7 @@ function getLogList(count, page, keyword, fromDate, endDate) {
|
|
|
tbody.appendChild(trow);
|
|
|
(function(i) {
|
|
|
$("#para_detail_" + logList[i].id ).click(function () {
|
|
|
- getPara(logList[i].id);
|
|
|
+ getPara(logList[i].id, logList[i].enName, logList[i].url);
|
|
|
$('#loadingDiv').show();
|
|
|
});
|
|
|
})(i)
|
|
|
@@ -88,15 +89,40 @@ function getLogList(count, page, keyword, fromDate, endDate) {
|
|
|
*
|
|
|
* @param id 主表id
|
|
|
*/
|
|
|
-function getPara(id) {
|
|
|
+function getPara(id, name, url) {
|
|
|
$.get('log/para', {id: id}, function (data) {
|
|
|
- var content = document.getElementById('para-content');
|
|
|
- content.innerText = data.content;
|
|
|
+ $('#para-content').empty();
|
|
|
+ $('#para-title').empty();
|
|
|
+ $("<p style='font-size: 16px; font-weight: bold'>").text(name).appendTo("#para-title");
|
|
|
+ var result = JSON.stringify(JSON.parse(data.content), null, 4);
|
|
|
+ $("<pre>").html(syntaxHighlight(result)).appendTo("#para-content");
|
|
|
$('#loadingDiv').hide();
|
|
|
$('#paraDetail').modal('show');
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+function syntaxHighlight(json) {
|
|
|
+ if (typeof json != 'string') {
|
|
|
+ json = JSON.stringify(json, undefined, 2);
|
|
|
+ }
|
|
|
+ json = json.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
|
+ return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function(match) {
|
|
|
+ var cls = 'number';
|
|
|
+ if (/^"/.test(match)) {
|
|
|
+ if (/:$/.test(match)) {
|
|
|
+ cls = 'key';
|
|
|
+ } else {
|
|
|
+ cls = 'string';
|
|
|
+ }
|
|
|
+ } else if (/true|false/.test(match)) {
|
|
|
+ cls = 'boolean';
|
|
|
+ } else if (/null/.test(match)) {
|
|
|
+ cls = 'null';
|
|
|
+ }
|
|
|
+ return '<span class="' + cls + '">' + match + '</span>';
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* 建立表格数据
|
|
|
*
|
|
|
@@ -134,6 +160,8 @@ function getDataRow(log, i) {
|
|
|
|
|
|
var msgCell = document.createElement('td'); //msg
|
|
|
msgCell.setAttribute("class", "text-center");
|
|
|
+ msgCell.setAttribute("title", log.msg);
|
|
|
+ msgCell.setAttribute("style", "max-height: 400px; overflow-y: auto;");
|
|
|
msgCell.innerHTML = log.msg; //填充数据
|
|
|
row.appendChild(msgCell);
|
|
|
|
|
|
@@ -142,13 +170,13 @@ function getDataRow(log, i) {
|
|
|
detailCell.setAttribute("title", log.detail);
|
|
|
detailCell.setAttribute("id", "pa_detail");
|
|
|
var result = JSON.stringify(JSON.parse(log.detail), null, 4);
|
|
|
- $("<pre>").text(result).appendTo(detailCell);
|
|
|
+ $("<pre>").html(syntaxHighlight(result)).appendTo(detailCell);
|
|
|
row.appendChild(detailCell);
|
|
|
|
|
|
var paraCell = document.createElement('td'); //parameters
|
|
|
paraCell.setAttribute("class", "text-center");
|
|
|
- paraCell.setAttribute("title", "查看详情");
|
|
|
- paraCell.innerHTML = "查看参数详情"; //填充数据
|
|
|
+ paraCell.setAttribute("title", "查看参数详情");
|
|
|
+ paraCell.innerHTML = "详情"; //填充数据
|
|
|
paraCell.setAttribute("id", "para_detail_" + log.id)
|
|
|
row.appendChild(paraCell);
|
|
|
|