mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-06 14:50:25 +08:00
全局访问日志增加WAF日志/优化交互/数据看板--WAF--最新拦截记录增加更多链接
This commit is contained in:
@@ -25,6 +25,7 @@ func (this *IndexAction) RunGet(params struct {
|
||||
Ip string
|
||||
Domain string
|
||||
HasError int
|
||||
HasWAF int
|
||||
|
||||
RequestId string
|
||||
ServerId int64
|
||||
@@ -41,6 +42,7 @@ func (this *IndexAction) RunGet(params struct {
|
||||
this.Data["domain"] = params.Domain
|
||||
this.Data["accessLogs"] = []interface{}{}
|
||||
this.Data["hasError"] = params.HasError
|
||||
this.Data["hasWAF"] = params.HasWAF
|
||||
|
||||
day := params.Day
|
||||
ipList := []string{}
|
||||
@@ -55,6 +57,7 @@ func (this *IndexAction) RunGet(params struct {
|
||||
RequestId: params.RequestId,
|
||||
ServerId: params.ServerId,
|
||||
HasError: params.HasError > 0,
|
||||
HasFirewallPolicy: params.HasWAF > 0,
|
||||
Day: day,
|
||||
Keyword: params.Keyword,
|
||||
Ip: params.Ip,
|
||||
@@ -90,6 +93,7 @@ func (this *IndexAction) RunGet(params struct {
|
||||
RequestId: params.RequestId,
|
||||
ServerId: params.ServerId,
|
||||
HasError: params.HasError > 0,
|
||||
HasFirewallPolicy: params.HasWAF > 0,
|
||||
Day: day,
|
||||
Keyword: params.Keyword,
|
||||
Ip: params.Ip,
|
||||
|
||||
@@ -23,25 +23,59 @@ Vue.component("http-access-log-search-box", {
|
||||
keyword: keyword
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
cleanIP: function () {
|
||||
this.ip = ""
|
||||
this.submit()
|
||||
},
|
||||
cleanDomain: function () {
|
||||
this.domain = ""
|
||||
this.submit()
|
||||
},
|
||||
cleanKeyword: function () {
|
||||
this.keyword = ""
|
||||
this.submit()
|
||||
},
|
||||
submit: function () {
|
||||
let parent = this.$el.parentNode
|
||||
while (true) {
|
||||
if (parent == null) {
|
||||
break
|
||||
}
|
||||
if (parent.tagName == "FORM") {
|
||||
break
|
||||
}
|
||||
parent = parent.parentNode
|
||||
}
|
||||
if (parent != null) {
|
||||
setTimeout(function () {
|
||||
parent.submit()
|
||||
}, 500)
|
||||
}
|
||||
}
|
||||
},
|
||||
template: `<div>
|
||||
<div class="margin"></div>
|
||||
<div class="ui fields inline">
|
||||
<div class="ui field">
|
||||
<div class="ui input left labeled small">
|
||||
<div class="ui input left right labeled small">
|
||||
<span class="ui label basic" style="font-weight: normal">IP</span>
|
||||
<input type="text" name="ip" placeholder="x.x.x.x" size="15" v-model="ip"/>
|
||||
<a class="ui label basic" :class="{disabled: ip.length == 0}" @click.prevent="cleanIP"><i class="icon remove small"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui field">
|
||||
<div class="ui input left labeled small">
|
||||
<div class="ui input left labeled small" :class="{'right labeled': domain.length > 0}">
|
||||
<span class="ui label basic" style="font-weight: normal">域名</span>
|
||||
<input type="text" name="domain" placeholder="xxx.com" size="15" v-model="domain"/>
|
||||
<a class="ui label basic" :class="{disabled: domain.length == 0}" @click.prevent="cleanDomain"><i class="icon remove small"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui field">
|
||||
<div class="ui input left labeled small">
|
||||
<div class="ui input left labeled small" :class="{'right labeled': keyword.length > 0}">
|
||||
<span class="ui label basic" style="font-weight: normal">关键词</span>
|
||||
<input type="text" name="keyword" v-model="keyword" placeholder="路径、UserAgent等..." size="18"/>
|
||||
<a class="ui label basic" :class="{disabled: keyword.length == 0}" @click.prevent="cleanKeyword"><i class="icon remove small"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<slot></slot>
|
||||
|
||||
@@ -34,4 +34,8 @@
|
||||
font-size: 0.8em;
|
||||
padding: 4px;
|
||||
}
|
||||
h4.header a {
|
||||
font-size: 0.85em;
|
||||
float: right;
|
||||
}
|
||||
/*# sourceMappingURL=waf.css.map */
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["waf.less"],"names":[],"mappings":"AAAA,GAAG,QACF;EACC,kBAAA;EACA,UAAA;EACA,UAAA;;AAIF;EACC,0BAAA;EACA,2BAAA;;AAFD,KAIC;EACC,kBAAA;EACA,4BAAA;;AANF,KAIC,QAIC,IAAG;EACF,iBAAA;;AATH,KAIC,QAIC,IAAG,MAGF;EACC,cAAA;EACA,mBAAA;;AAbJ,KAkBC,QAAO;EACN,eAAA;;AAnBF,KAsBC,GACC;EACC,aAAA;;AAxBH,KA4BC,QAAO,MACN;EACC,eAAA;;AAKH;EACC,YAAA;;AAGD;EACC,gBAAA;EACA,YAAA","file":"waf.css"}
|
||||
{"version":3,"sources":["waf.less"],"names":[],"mappings":"AAAA,GAAG,QACF;EACC,kBAAA;EACA,UAAA;EACA,UAAA;;AAIF;EACC,0BAAA;EACA,2BAAA;;AAFD,KAIC;EACC,kBAAA;EACA,4BAAA;;AANF,KAIC,QAIC,IAAG;EACF,iBAAA;;AATH,KAIC,QAIC,IAAG,MAGF;EACC,cAAA;EACA,mBAAA;;AAbJ,KAkBC,QAAO;EACN,eAAA;;AAnBF,KAsBC,GACC;EACC,aAAA;;AAxBH,KA4BC,QAAO,MACN;EACC,eAAA;;AAKH;EACC,YAAA;;AAGD;EACC,gBAAA;EACA,YAAA;;AAGD,EAAE,OACD;EACC,iBAAA;EACA,YAAA","file":"waf.css"}
|
||||
@@ -27,7 +27,7 @@
|
||||
<!-- 最近日志 -->
|
||||
<div v-if="accessLogs.length > 0">
|
||||
<div class="ui divider"></div>
|
||||
<h4>最新拦截记录</h4>
|
||||
<h4 class="header">最新拦截记录 <a href="/servers/logs?hasWAF=1">更多 »</a></h4>
|
||||
<table class="ui table selectable">
|
||||
<tr v-for="accessLog in accessLogs" :key="accessLog.requestId">
|
||||
<td><http-access-log-box :v-access-log="accessLog"></http-access-log-box></td>
|
||||
|
||||
@@ -49,3 +49,10 @@
|
||||
font-size: 0.8em;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
h4.header {
|
||||
a {
|
||||
font-size: 0.85em;
|
||||
float: right;
|
||||
}
|
||||
}
|
||||
@@ -2,13 +2,15 @@
|
||||
{$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 + '&keyword=' + keyword + '&ip=' + ip + '&domain=' + domain" :active="hasError == 0 && hasWAF == 0">所有日志</menu-item>
|
||||
<menu-item :href="path + '?serverId=' + serverId + '&day=' + day + '&hasError=1' + '&keyword=' + keyword + '&ip=' + ip + '&domain=' + domain" :active="hasError > 0">错误日志</menu-item>
|
||||
<menu-item :href="path + '?serverId=' + serverId + '&day=' + day + '&hasWAF=1' + '&keyword=' + keyword + '&ip=' + ip + '&domain=' + domain" :active="hasWAF > 0">WAF日志</menu-item>
|
||||
</first-menu>
|
||||
|
||||
<form method="get" class="ui form small" :action="path" autocomplete="off">
|
||||
<form method="get" class="ui form small" :action="path">
|
||||
<input type="hidden" name="serverId" :value="serverId"/>
|
||||
<input type="hidden" name="hasError" :value="hasError"/>
|
||||
<input type="hidden" name="hasWAF" :value="hasWAF"/>
|
||||
<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"/>
|
||||
@@ -26,9 +28,9 @@
|
||||
</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>
|
||||
<a :href="path + '?serverId=' + serverId + '&requestId=' + lastRequestId + '&day=' + day + '&hasError=' + hasError + '&hasWAF=' + hasWAF + '&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>
|
||||
<a :href="path + '?serverId=' + serverId + '&requestId=' + nextRequestId + '&day=' + day + '&hasError=' + hasError + '&hasWAF=' + hasWAF + '&keyword=' + keyword + '&ip=' + ip + '&domain=' + domain" v-if="hasMore">下一页</a>
|
||||
<span v-else class="disabled">下一页</span>
|
||||
</div>
|
||||
Reference in New Issue
Block a user