mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-30 17:00:26 +08:00
增加全局访问日志
This commit is contained in:
33
web/views/@default/servers/logs/index.html
Normal file
33
web/views/@default/servers/logs/index.html
Normal file
@@ -0,0 +1,33 @@
|
||||
{$layout}
|
||||
{$template "/datepicker"}
|
||||
|
||||
<first-menu>
|
||||
<menu-item :href="path + '?serverId=' + serverId + '&day=' + day + '&keyword=' + keyword + '&ip=' + ip + '&domain=' + domain" :active="hasError == 0">所有日志</menu-item>
|
||||
<menu-item :href="path + '?serverId=' + serverId + '&day=' + day + '&hasError=1' + '&keyword=' + keyword + '&ip=' + ip + '&domain=' + domain" :active="hasError > 0">错误日志</menu-item>
|
||||
</first-menu>
|
||||
|
||||
<form method="get" class="ui form small" :action="path" autocomplete="off">
|
||||
<input type="hidden" name="serverId" :value="serverId"/>
|
||||
<http-access-log-search-box :v-ip="ip" :v-domain="domain" :v-keyword="keyword">
|
||||
<div class="ui field">
|
||||
<input type="text" name="day" maxlength="10" placeholder="选择日期" style="width:7.8em" id="day-input" v-model="day"/>
|
||||
</div>
|
||||
</http-access-log-search-box>
|
||||
</form>
|
||||
|
||||
<p class="comment" v-if="accessLogs.length == 0">暂时还没有访问日志。</p>
|
||||
|
||||
<table class="ui table selectable" v-if="accessLogs.length > 0">
|
||||
<!-- 这里之所以需要添加 :key,是因为要不然不会刷新显示 -->
|
||||
<tr v-for="accessLog in accessLogs" :key="accessLog.requestId">
|
||||
<td><http-access-log-box :v-access-log="accessLog" :v-keyword="keyword"></http-access-log-box></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div v-if="accessLogs.length > 0">
|
||||
<a :href="path + '?serverId=' + serverId + '&requestId=' + lastRequestId + '&day=' + day + '&hasError=' + hasError + '&keyword=' + keyword + '&ip=' + ip + '&domain=' + domain" v-if="hasPrev">上一页</a>
|
||||
<span v-else class="disabled">上一页</span>
|
||||
<span class="disabled"> | </span>
|
||||
<a :href="path + '?serverId=' + serverId + '&requestId=' + nextRequestId + '&day=' + day + '&hasError=' + hasError + '&keyword=' + keyword + '&ip=' + ip + '&domain=' + domain" v-if="hasMore">下一页</a>
|
||||
<span v-else class="disabled">下一页</span>
|
||||
</div>
|
||||
17
web/views/@default/servers/logs/index.js
Normal file
17
web/views/@default/servers/logs/index.js
Normal file
@@ -0,0 +1,17 @@
|
||||
Tea.context(function () {
|
||||
this.$delay(function () {
|
||||
let that = this
|
||||
teaweb.datepicker("day-input", function (day) {
|
||||
that.day = day
|
||||
})
|
||||
})
|
||||
|
||||
let that = this
|
||||
this.accessLogs.forEach(function (accessLog) {
|
||||
if (typeof (that.regions[accessLog.remoteAddr]) == "string") {
|
||||
accessLog.region = that.regions[accessLog.remoteAddr]
|
||||
} else {
|
||||
accessLog.region = ""
|
||||
}
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user