...
|
...
|
@@ -18,14 +18,21 @@ |
|
|
|
|
|
<div class="contentpanel page-servers">
|
|
|
<div class="panel panel-primary-head">
|
|
|
<!--<div class="panel-heading">-->
|
|
|
<!--<div class="pull-right">-->
|
|
|
<!--<a id="new-page" href="/servers/new" class="btn btn-success btn-rounded"><i class="glyphicon glyphicon-plus"></i> 新增服务器</a>-->
|
|
|
<!--</div>-->
|
|
|
<!--<h4 class="panel-title">服务器设置</h4>-->
|
|
|
<!--<p>配置服务器连接方式、可以通过标签区分</p>-->
|
|
|
|
|
|
<!--</div>-->
|
|
|
<div class="panel-heading" style="overflow: hidden">
|
|
|
<div id="reportrange" class="pull-left"
|
|
|
style="display: inline-block; background: #fff; cursor: pointer; padding: 9px 10px; border: 1px solid #ccc; width: 250px; color: black">
|
|
|
<i class="glyphicon glyphicon-calendar fa fa-calendar"></i>
|
|
|
<span></span> <b class="caret"></b>
|
|
|
</div>
|
|
|
|
|
|
<div class="pull-left">
|
|
|
<select id="selectedApp" class="selectpicker show-menu-arrow form-control" style="margin-left: 10px;">
|
|
|
<option value="default">全部</option>
|
|
|
<option value="pc">PC</option>
|
|
|
<option value="h5">H5</option>
|
|
|
</select>
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- panel-heading -->
|
|
|
|
|
|
<table id="table-servers" class="table table-striped table-bordered responsive">
|
...
|
...
|
@@ -48,23 +55,6 @@ |
|
|
</thead>
|
|
|
|
|
|
<tbody>
|
|
|
{{#each errors}}
|
|
|
<tr>
|
|
|
<td>{{time}}</td>
|
|
|
<td>{{app}}</td>
|
|
|
<td>{{type}}</td>
|
|
|
<td>{{preqID}}</td>
|
|
|
<td>{{reqID}}</td>
|
|
|
<td>{{uid}}</td>
|
|
|
<td>{{udid}}</td>
|
|
|
<td>{{code}}</td>
|
|
|
<td>{{message}}</td>
|
|
|
<td>{{script}}</td>
|
|
|
<td>{{line}}</td>
|
|
|
<td>{{column}}</td>
|
|
|
<td>{{stack}}</td>
|
|
|
</tr>
|
|
|
{{/each}}
|
|
|
</tbody>
|
|
|
</table>
|
|
|
</div>
|
...
|
...
|
@@ -73,42 +63,129 @@ |
|
|
|
|
|
|
|
|
<script>
|
|
|
$(document).off().on('ready pjax:end', function() {
|
|
|
|
|
|
console.log('page: servers');
|
|
|
|
|
|
// $("#table-servers").on('draw.dt', function() {
|
|
|
// eventBind();
|
|
|
// });
|
|
|
|
|
|
function eventBind() {
|
|
|
$('.server-del').off().on('click', function(){
|
|
|
var id = $(this).parent().data('id');
|
|
|
$.post('/servers/del', {id: id}, function(ret){
|
|
|
if(ret.code == 200){
|
|
|
var i = layer.alert('操作成功', function(){
|
|
|
layer.close(i);
|
|
|
location.href = location.href;
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
$('.server-edit').off().on('click', function(){
|
|
|
var id = $(this).parent().data('id');
|
|
|
location.href = '/servers/edit?id=' + id;
|
|
|
});
|
|
|
var selectedStarTime, selectedEndTime, selectedApp;
|
|
|
var data_end_point = '/profile/error.json';
|
|
|
var dataTable = null;
|
|
|
var handleChanged = skipOnce(_handleChanged);
|
|
|
|
|
|
function ajaxUrl() {
|
|
|
return `${data_end_point}?start=${selectedStarTime.format('YYYY-MM-DD')}&end=${selectedEndTime.format('YYYY-MM-DD')}&app=${selectedApp}`
|
|
|
}
|
|
|
|
|
|
function skipOnce(fn) {
|
|
|
var count = 0;
|
|
|
|
|
|
return function() {
|
|
|
if (count++ >= 1) fn.apply(null, arguments);
|
|
|
return null
|
|
|
}
|
|
|
}
|
|
|
|
|
|
eventBind();
|
|
|
$(function() {
|
|
|
init();
|
|
|
initTable();
|
|
|
initDatePicker();
|
|
|
initSelect();
|
|
|
});
|
|
|
|
|
|
function init() {
|
|
|
selectedStarTime = moment();
|
|
|
selectedEndTime = moment().add(1, 'days');
|
|
|
selectedApp = 'default';
|
|
|
}
|
|
|
|
|
|
$("#table-servers").DataTable({
|
|
|
function initTable() {
|
|
|
dataTable = $("#table-servers").DataTable({
|
|
|
pageLength: 20,
|
|
|
retrieve: true,
|
|
|
responsive: true,
|
|
|
searching: false
|
|
|
searching: true,
|
|
|
ajax: ajaxUrl(),
|
|
|
dataSrc: 'data',
|
|
|
pageLength: 25,
|
|
|
deferLoading: 0,
|
|
|
columns: [
|
|
|
{ data: 'time' },
|
|
|
{ data: 'app' },
|
|
|
{ data: 'type' },
|
|
|
{ data: 'preqID' },
|
|
|
{ data: 'reqID' },
|
|
|
{ data: 'uid' },
|
|
|
{ data: 'udid' },
|
|
|
{ data: 'code' },
|
|
|
{ data: 'message' },
|
|
|
{ data: 'script' },
|
|
|
{ data: 'line' },
|
|
|
{ data: 'column' },
|
|
|
{ data: 'stack' }
|
|
|
],
|
|
|
columnDefs: [
|
|
|
{
|
|
|
render: function ( data, type, row ) {
|
|
|
return moment(data).format('YYYY/MM/DD HH:MM:ss');
|
|
|
},
|
|
|
targets: 0
|
|
|
}
|
|
|
],
|
|
|
order: [[ 0, "desc" ]]
|
|
|
});
|
|
|
}
|
|
|
|
|
|
});
|
|
|
function initDatePicker() {
|
|
|
var start = selectedStarTime;
|
|
|
var end = selectedEndTime;
|
|
|
|
|
|
|
|
|
$('#reportrange span').html('今天');
|
|
|
|
|
|
function cb(start, end, label) {
|
|
|
if (label !== '自定义日期') {
|
|
|
$('#reportrange span').html(label);
|
|
|
} else {
|
|
|
$('#reportrange span').html(start.format('YYYY-MM-DD') + ' 至 ' + end.format('YYYY-MM-DD'))
|
|
|
}
|
|
|
|
|
|
selectedStarTime = start;
|
|
|
selectedEndTime = end;
|
|
|
|
|
|
handleChanged();
|
|
|
}
|
|
|
|
|
|
$('#reportrange').daterangepicker({
|
|
|
startDate: start,
|
|
|
endDate: end,
|
|
|
ranges: {
|
|
|
'今天': [moment(), moment().add(1, 'days')],
|
|
|
'昨天': [moment().subtract(1, 'days'), moment()],
|
|
|
'最近 7 天': [moment().subtract(6, 'days'), moment().add(1, 'days')],
|
|
|
'最近 30 天': [moment().subtract(29, 'days'), moment().add(1, 'days')],
|
|
|
'本月': [moment().startOf('month'), moment().endOf('month')],
|
|
|
'上个月': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
|
|
|
},
|
|
|
locale: {
|
|
|
format: "YYYY-MM-DD",
|
|
|
applyLabel: '确定',
|
|
|
cancelLabel: '取消',
|
|
|
weekLabel: 'W',
|
|
|
customRangeLabel: '自定义日期',
|
|
|
daysOfWeek: '一_二_三_四_五_六_日'.split('_'),
|
|
|
monthNames: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),
|
|
|
firstDay: 1
|
|
|
},
|
|
|
}, cb);
|
|
|
|
|
|
cb(start, end);
|
|
|
}
|
|
|
|
|
|
function initSelect() {
|
|
|
$('#selectedApp').change(function() {
|
|
|
selectedApp = $('#selectedApp').val();
|
|
|
handleChanged();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
function _handleChanged() {
|
|
|
dataTable && dataTable.ajax.url(ajaxUrl()).load();
|
|
|
}
|
|
|
|
|
|
</script> |
|
|
\ No newline at end of file |
...
|
...
|
|