WAF显示拦截日志

This commit is contained in:
GoEdgeLab
2020-11-02 14:37:28 +08:00
parent a3922492ac
commit 58805c05f5
6 changed files with 186 additions and 32 deletions
@@ -17,6 +17,6 @@ Vue.component("http-access-log-box", {
}
},
template: `<div :style="{'color': (accessLog.status >= 400) ? '#dc143c' : ''}">
{{accessLog.remoteAddr}} [{{accessLog.timeLocal}}] <em>&quot;{{accessLog.requestMethod}} {{accessLog.scheme}}://{{accessLog.host}}{{accessLog.requestURI}} <a :href="accessLog.scheme + '://' + accessLog.host + accessLog.requestURI" target="_blank" title="新窗口打开" class="disabled"><i class="external icon tiny"></i> </a> {{accessLog.proto}}&quot; </em> {{accessLog.status}} <span v-if="accessLog.attrs != null && accessLog.attrs['cache_cached'] == '1'">[cached]</span> <span v-if="accessLog.attrs != null && accessLog.attrs['waf_action'] != null && accessLog.attrs['waf_action'].length > 0">[waf {{accessLog.attrs['waf_action']}}]</span> - 耗时:{{formatCost(accessLog.requestTime)}} ms
{{accessLog.remoteAddr}} [{{accessLog.timeLocal}}] <em>&quot;{{accessLog.requestMethod}} {{accessLog.scheme}}://{{accessLog.host}}{{accessLog.requestURI}} <a :href="accessLog.scheme + '://' + accessLog.host + accessLog.requestURI" target="_blank" title="新窗口打开" class="disabled"><i class="external icon tiny"></i> </a> {{accessLog.proto}}&quot; </em> {{accessLog.status}} <span v-if="accessLog.attrs != null && accessLog.attrs['cache_cached'] == '1'">[cached]</span> <span v-if="accessLog.attrs != null && accessLog.attrs['waf.action'] != null && accessLog.attrs['waf.action'].length > 0">[waf {{accessLog.attrs['waf.action']}}]</span> - 耗时:{{formatCost(accessLog.requestTime)}} ms
</div>`
})
@@ -54,7 +54,7 @@ Vue.component("http-firewall-config-box", {
<option value="0">[请选择]</option>
<option v-for="policy in vFirewallPolicies" :value="policy.id">{{policy.name}}</option>
</select>
<p class="comment" v-if="selectedPolicy != null"><span v-if="!selectedPolicy.isOn" class="red">[正在停用的策略]</span>{{selectedPolicy.description}}</p>
<p class="comment" v-if="selectedPolicy != null"><span v-if="!selectedPolicy.isOn" class="red">[正在停用的策略]</span>{{selectedPolicy.description}} &nbsp; <a :href="'/servers/components/waf/policy?firewallPolicyId=' + selectedPolicy.id">详情&raquo;</a> </p>
</div>
</td>
</tr>
@@ -1,8 +1,49 @@
{$layout}
{$var "header"}
<!-- datepicker -->
<script type="text/javascript" src="/js/moment.min.js"></script>
<script type="text/javascript" src="/js/pikaday.js"></script>
<link rel="stylesheet" href="/js/pikaday.css"/>
<link rel="stylesheet" href="/js/pikaday.theme.css"/>
<link rel="stylesheet" href="/js/pikaday.triangle.css"/>
{$end}
{$template "/left_menu"}
<div class="right-box">
{$template "waf_menu"}
<p class="ui message">此功能暂未开放,敬请期待。</p>
<first-menu>
<div class="item right">
<form class="ui form small" :action="path" autocomplete="off">
<input type="hidden" name="firewallPolicyId" :value="firewallPolicyId"/>
<div class="ui fields inline">
<div class="ui field">
<input type="text" name="day" maxlength="10" placeholder="选择日期" style="width:7.8em" id="day-input" v-model="day"/>
</div>
<div class="ui field">
<button class="ui button small" type="submit">查找</button>
</div>
</div>
</form>
</div>
</first-menu>
<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"></http-access-log-box></td>
</tr>
</table>
<div v-if="accessLogs.length > 0">
<a :href="path + '?requestId=' + lastRequestId + '&day=' + day + '&firewallPolicyId=' + firewallPolicyId" v-if="hasPrev">上一页</a>
<span v-else class="disabled">上一页</span>
<span class="disabled">&nbsp; | &nbsp;</span>
<a :href="path + '?requestId=' + nextRequestId + '&day=' + day + '&firewallPolicyId=' + firewallPolicyId" v-if="hasMore">下一页</a>
<span v-else class="disabled">下一页</span>
</div>
</div>
@@ -0,0 +1,8 @@
Tea.context(function () {
this.$delay(function () {
let that = this
teaweb.datepicker("day-input", function (day) {
that.day = day
})
})
})