monitor_log.html
4.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<html>
<head>
<script>
function showApiLog(id){
$("#table-api-log tbody").empty();
$.ajax({
url : "/apiLog" , //获取数据列
type : 'GET',
data : {"id":id},
success : function(data) {
var tbody = "";
$.each(data,function(n,value) {
var log = value.log ? value.log : "";
var trs = "<tr>"
+"<td>"+value.httpMethod+"</td>"
+"<td>"+value.url+"</td>"
+"<td>"+ (value.status == true ? "成功":"失败")+"</td>"
+"<td>"+value.statusCode+"</td>"
+"<td>"+value.costTime+"毫秒</td>"
+"<td>"+log+"</td>"
+"</tr>";
tbody += trs;
});
$("#table-api-log tbody").append(tbody);
$("#modal-default").modal();
}
});
}
$(function () {
$('#example1').DataTable({
'paging' : true,
'lengthChange': true,
'searching' : true,
'ordering' : true,
'info' : true,
'autoWidth' : true
})
})
</script>
</head>
<body>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
监控日志
<small>API监控</small>
</h1>
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-dashboard"></i> 主页</a></li>
<li><a href="/monitorList">API监控</a></li>
<li class="active">监控日志</li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<h3 class="box-title" th:text="${sequenceName}+'-监控日志'"></h3>
</div>
<!-- /.box-header -->
<div class="box-body table-responsive">
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<th>监控时间</th>
<th>状态</th>
<th>响应时间</th>
<th>日志</th>
<th>API详情</th>
</tr>
</thead>
<tbody>
<tr th:each="item:${sequencelogs}">
<td th:text="${item.createTime}"></td>
<td>
<i th:if="${item.status} eq true" class="fa fa-circle text-green">正常</i>
<i th:if="${item.status} eq false" class="fa fa-circle text-red">故障</i>
</td>
<td th:text="${item.costTime}+' 毫秒'"></td>
<td th:text="${item.log}"></td>
<td><button th:onclick="'showApiLog('+${item.id}+');'" type="button" class="btn btn-default btn-sm"><i class="fa fa-ellipsis-h"></i></button></td>
</tr>
</tbody>
<tfoot>
</tfoot>
</table>
</div>
<!-- /.box-body -->
<div class="box-footer">
<a class="btn btn-default" href="/monitorList">返回</a>
</div>
<!-- /.box-footer -->
</div>
<!-- /.box -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->
<div class="modal fade" id="modal-default">
<div class="modal-dialog" style="width:900px">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span></button>
<h4 class="modal-title">API日志详情</h4>
</div>
<div class="modal-body">
<div class="box-body table-responsive">
<table id="table-api-log" class="table table-bordered table-striped">
<thead>
<tr>
<th>API类型</th>
<th>API地址</th>
<th>状态</th>
<th>响应状态码</th>
<th>响应时间</th>
<th>日志</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
</tfoot>
</table>
</div>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
</body>
</html>