Authored by htoooth

fix

... ... @@ -352,7 +352,7 @@ const profile_controller = {
await ctx.render('action/sort_client_list', Object.assign({}, {
layout: false
}, result));
}
},
};
r.get('/server', profile_controller.server_mean_report_index);
... ... @@ -370,4 +370,4 @@ r.post('/sort_api_list', profile_controller.sort_api_list);
r.get('/sort_client', profile_controller.sort_client);
r.post('/sort_client_list', profile_controller.sort_client_list);
module.exports = r;
\ No newline at end of file
module.exports = r;
... ...
... ... @@ -51,7 +51,7 @@ class errorModel extends model {
}
let recordsTotal = await this.mysql.query(`SELECT COUNT(*) as count from error_report where 1=1 ${query}`, queryVal).then(([r]) => r.count);
let data = await this.mysql.query(`SELECT id, app, type, preqid, reqid, uid, udid, code, route, api, line, script, message, stack, create_time as time, 'detail' from error_report where 1=1 ${query} order by create_time desc limit ?, ? `, [...queryVal, start, length]);
let data = await this.mysql.query(`SELECT id, app, type, preqid, reqid, uid, udid, code, route, api, line, script, message, stack, useragent, create_time as time, 'detail' from error_report where 1=1 ${query} order by create_time desc limit ?, ? `, [...queryVal, start, length]);
return {
recordsTotal,
... ...
... ... @@ -21,10 +21,11 @@
margin-right: 10px;
margin-bottom: 10px;
}
.time, .app, .type, .route, .api, .uid, .code, .preqid, .reqid, .script, .message, .stack {
.time, .app, .type, .route, .api, .uid, .code, .preqid, .reqid, .script, .message, .stack .useragent{
word-wrap: break-word;
word-break:break-all;
}
</style>
... ... @@ -169,6 +170,10 @@
<td class="uid"></td>
</tr>
<tr>
<td>useragent</td>
<td class="useragent"></td>
</tr>
<tr>
<td>错识状态码</td>
<td class="code"></td>
</tr>
... ... @@ -236,6 +241,13 @@
initDatePicker();
});
function formateDate(d) {
return (d.getMonth() + 1) + "/" + d.getDate() + "/" + d.getFullYear() +
' ' + ("0" + d.getHours()).slice(-2) + ":" +
( "0" + d.getMinutes()).slice(-2) + ":" +
( "0" + d.getSeconds()).slice(-2)
}
function initTable() {
dataTable = $("#table-servers").DataTable({
pageLength: 20,
... ... @@ -245,6 +257,7 @@
ajax: ajaxUrl(),
dataSrc: 'data',
pageLength: 25,
ordering: false,
columns: [
{data: 'time'},
{data: 'app'},
... ... @@ -270,7 +283,7 @@
return '';
}
return moment(data).format('YYYY/MM/DD HH:MM:ss');
return formateDate(new Date(data));
},
targets: 0,
width: '12%'
... ... @@ -328,10 +341,11 @@
$('.script').text('');
$('.message').text('');
$('.stack').text('');
$('.useragent').text('');
}
function setModalData(data) {
$('.time').text(moment(data.time).format('YYYY/MM/DD HH:MM:ss'));
$('.time').text(formateDate(new Date(data.time)));
$('.app').text(data.app);
$('.type').text(data.type);
$('.route').text(data.route);
... ... @@ -343,6 +357,7 @@
$('.script').text(data.script);
$('.message').text(data.message);
$('.stack').text(data.stack);
$('.useragent').text(data.useragent);
}
const TIME = {
... ... @@ -366,15 +381,15 @@
$('#reportrange span').html(label);
var lastTime = TIME[label];
var selectedStartTime = moment().subtract(...lastTime).unix();
var selectedEndTime = moment().unix();
var selectedStartTime = moment().subtract(...lastTime).valueOf();
var selectedEndTime = moment().valueOf();
query.time = `${selectedStartTime}:${selectedEndTime}`;
} else if (label && label === '自定义日期'){
$('#reportrange span').html(start.format('YYYY-MM-DD') + ' 至 ' + end.format('YYYY-MM-DD'));
var selectedStartTime = start.format('YYYY-MM-DD').unix();
var selectedEndTime = end.format('YYYY-MM-DD').unix();
var selectedStartTime = moment(start.format('YYYY-MM-DD')).valueOf();
var selectedEndTime = moment(end.add(1, 'd').format('YYYY-MM-DD')).valueOf();
query.time = `${selectedStartTime}:${selectedEndTime}`;
}
... ... @@ -417,7 +432,11 @@
}
function initSelect() {
$('#selectedHost').change(function() {
$('#selectedHost').select2({
width: 'resolve'
});
$('#selectedHost').on('change', function() {
query.hostname = $('#selectedHost').val();
});
... ... @@ -433,12 +452,20 @@
query.code = $('#selectedCode').val();
});
$('#selectedRoute').change(function() {
$('#selectedRoute').select2( {
width: 'resolve'
});
$('#selectedRoute').on('change', function() {
query.route = $('#selectedRoute').val();
});
$('#selectedApi').change(function() {
query.api = $('#selectedApi').val();
$('#selectedApi').select2({
width: 'resolve'
});
$('#selectedApi').on("change", function() {
query.api = $('#selectedApi').val()
});
$('#search').on('click', () => {
... ... @@ -455,12 +482,13 @@
}
function clearSelect() {
$('#selectedHost').val('');
$('#selectedHost').val('').change();
$('#selectedApp').val('');
$('#selectedType').val('');
$('#selectedCode').val('');
$('#selectedRoute').val('');
$('#selectedApi').val('');
$('#selectedRoute').val('').change();
$('#selectedApi').val('').change();
$('#reportrange').trigger('cancel.daterangepicker');
query = {
... ...
... ... @@ -221,15 +221,15 @@
$('#reportrange span').html(label);
var lastTime = TIME[label];
var selectedStartTime = moment().subtract(...lastTime).unix();
var selectedEndTime = moment().unix();
var selectedStartTime = moment().subtract(...lastTime).valueOf();
var selectedEndTime = moment().valueOf();
query.time = `${selectedStartTime}:${selectedEndTime}`;
} else if (label && label === '自定义日期'){
$('#reportrange span').html(start.format('YYYY-MM-DD') + ' 至 ' + end.format('YYYY-MM-DD'));
var selectedStartTime = start.format('YYYY-MM-DD').unix();
var selectedEndTime = end.format('YYYY-MM-DD').unix();
var selectedStartTime = moment(start.format('YYYY-MM-DD')).valueOf();
var selectedEndTime = moment(end.add(1, 'd').format('YYYY-MM-DD')).valueOf();
query.time = `${selectedStartTime}:${selectedEndTime}`;
}
... ...
... ... @@ -7,9 +7,9 @@
<ul class="breadcrumb">
<li><a href=""><i class="glyphicon glyphicon-home"></i></a></li>
<li><a href="">性能监控</a></li>
<li>api排行榜</li>
<li>浏览器排行榜</li>
</ul>
<h4>api排行榜</h4>
<h4>浏览器排行榜</h4>
</div>
</div>
<!-- media -->
... ... @@ -98,7 +98,7 @@
<div class="col-md-6 config-panel" data-type="slow">
<div class="panel panel-success">
<div class="panel-heading">
最慢降序
首屏最慢降序
</div>
<div class="panel-body">
... ... @@ -106,6 +106,9 @@
<thead>
<tr>
<td>
排序
</td>
<td>
路由
</td>
<td>
... ... @@ -117,19 +120,6 @@
<tbody>
{{#each time}}
<tr>
<td>
{{route}}
</td>
<td>
{{avg}}
</td>
</tr>
{{/each}}
</tbody>
</table>
... ... @@ -147,6 +137,9 @@
<thead>
<tr>
<td>
排序
</td>
<td>
路由
</td>
<td>
... ... @@ -158,19 +151,6 @@
<tbody>
{{#each count}}
<tr>
<td>
{{route}}
</td>
<td>
{{count}}
</td>
</tr>
{{/each}}
</tbody>
</table>
... ... @@ -221,15 +201,15 @@
$('#reportrange span').html(label);
var lastTime = TIME[label];
var selectedStartTime = moment().subtract(...lastTime).unix();
var selectedEndTime = moment().unix();
var selectedStartTime = moment().subtract(...lastTime).valueOf();
var selectedEndTime = moment().valueOf();
query.time = `${selectedStartTime}:${selectedEndTime}`;
} else if (label && label === '自定义日期'){
$('#reportrange span').html(start.format('YYYY-MM-DD') + ' 至 ' + end.format('YYYY-MM-DD'));
var selectedStartTime = start.format('YYYY-MM-DD').unix();
var selectedEndTime = end.format('YYYY-MM-DD').unix();
var selectedStartTime = moment(start.format('YYYY-MM-DD')).valueOf();
var selectedEndTime = moment(end.add(1, 'd').format('YYYY-MM-DD')).valueOf();
query.time = `${selectedStartTime}:${selectedEndTime}`;
}
... ...
... ... @@ -2,7 +2,7 @@
<div class="col-md-6 config-panel" data-type="slow">
<div class="panel panel-success">
<div class="panel-heading">
最慢降序
首屏最慢降序
</div>
<div class="panel-body">
... ... @@ -10,6 +10,9 @@
<thead>
<tr>
<td>
排序
</td>
<td>
路由
</td>
<td>
... ... @@ -24,6 +27,10 @@
{{#each time}}
<tr>
<td>
{{@index}}
</td>
<td>
{{route}}
</td>
... ... @@ -51,6 +58,10 @@
<thead>
<tr>
<td>
排序
</td>
<td>
路由
</td>
<td>
... ... @@ -65,6 +76,10 @@
{{#each count}}
<tr>
<td>
{{@index}}
</td>
<td>
{{route}}
</td>
... ...
... ... @@ -7,9 +7,9 @@
<ul class="breadcrumb">
<li><a href=""><i class="glyphicon glyphicon-home"></i></a></li>
<li><a href="">性能监控</a></li>
<li>路由排行榜</li>
<li>服务器排行榜</li>
</ul>
<h4>路由排行榜</h4>
<h4>服务器排行榜</h4>
</div>
</div>
<!-- media -->
... ... @@ -106,6 +106,9 @@
<thead>
<tr>
<td>
排序
</td>
<td>
路由
</td>
<td>
... ... @@ -117,19 +120,6 @@
<tbody>
{{#each time}}
<tr>
<td>
{{route}}
</td>
<td>
{{avg}}
</td>
</tr>
{{/each}}
</tbody>
</table>
... ... @@ -147,6 +137,9 @@
<thead>
<tr>
<td>
排序
</td>
<td>
路由
</td>
<td>
... ... @@ -158,19 +151,6 @@
<tbody>
{{#each count}}
<tr>
<td>
{{route}}
</td>
<td>
{{count}}
</td>
</tr>
{{/each}}
</tbody>
</table>
... ... @@ -221,15 +201,15 @@
$('#reportrange span').html(label);
var lastTime = TIME[label];
var selectedStartTime = moment().subtract(...lastTime).unix();
var selectedEndTime = moment().unix();
var selectedStartTime = moment().subtract(...lastTime).valueOf();
var selectedEndTime = moment().valueOf();
query.time = `${selectedStartTime}:${selectedEndTime}`;
} else if (label && label === '自定义日期'){
$('#reportrange span').html(start.format('YYYY-MM-DD') + ' 至 ' + end.format('YYYY-MM-DD'));
var selectedStartTime = start.format('YYYY-MM-DD').unix();
var selectedEndTime = end.format('YYYY-MM-DD').unix();
var selectedStartTime = moment(start.format('YYYY-MM-DD')).valueOf();
var selectedEndTime = moment(end.add(1, 'd').format('YYYY-MM-DD')).valueOf();
query.time = `${selectedStartTime}:${selectedEndTime}`;
}
... ...
... ... @@ -10,6 +10,9 @@
<thead>
<tr>
<td>
排序
</td>
<td>
路由
</td>
<td>
... ... @@ -24,6 +27,9 @@
{{#each time}}
<tr>
<td>
{{@index}}
</td>
<td>
{{route}}
</td>
... ... @@ -51,6 +57,10 @@
<thead>
<tr>
<td>
排序
</td>
<td>
路由
</td>
<td>
... ... @@ -65,6 +75,10 @@
{{#each count}}
<tr>
<td>
{{@index}}
</td>
<td>
{{route}}
</td>
... ...
... ... @@ -82,11 +82,10 @@
<li class="parent"><a><i class="fa fa-list"></i> <span>性能统计</span></a>
<ul class="children">
<li><a href="/profile/error"> <span>错误信息统计</span></a></li>
<li><a href="/profile/sort_route"> <span>路由排行榜</span></a></li>
<li><a href="/profile/sort_client"> <span>浏览器排行榜</span></a></li>
<li><a href="/profile/sort_route"> <span>服务器路由排行榜</span></a></li>
<li><a href="/profile/sort_api"> <span>api排行榜</span></a></li>
<li><a href="/profile/sort_client"> <span>client排行榜</span></a></li>
<li><a href="/profile/error"> <span>错误信息统计</span></a></li>
</ul>
</li>
{{/if}}
... ...