diff --git a/internal/web/actions/default/servers/logs/index.go b/internal/web/actions/default/servers/logs/index.go index 653be14d..acee5c91 100644 --- a/internal/web/actions/default/servers/logs/index.go +++ b/internal/web/actions/default/servers/logs/index.go @@ -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{} @@ -52,14 +54,15 @@ func (this *IndexAction) RunGet(params struct { this.Data["hasError"] = params.HasError resp, err := this.RPC().HTTPAccessLogRPC().ListHTTPAccessLogs(this.AdminContext(), &pb.ListHTTPAccessLogsRequest{ - RequestId: params.RequestId, - ServerId: params.ServerId, - HasError: params.HasError > 0, - Day: day, - Keyword: params.Keyword, - Ip: params.Ip, - Domain: params.Domain, - Size: size, + RequestId: params.RequestId, + ServerId: params.ServerId, + HasError: params.HasError > 0, + HasFirewallPolicy: params.HasWAF > 0, + Day: day, + Keyword: params.Keyword, + Ip: params.Ip, + Domain: params.Domain, + Size: size, }) if err != nil { this.ErrorPage(err) @@ -87,15 +90,16 @@ func (this *IndexAction) RunGet(params struct { if len(params.RequestId) > 0 { this.Data["hasPrev"] = true prevResp, err := this.RPC().HTTPAccessLogRPC().ListHTTPAccessLogs(this.AdminContext(), &pb.ListHTTPAccessLogsRequest{ - RequestId: params.RequestId, - ServerId: params.ServerId, - HasError: params.HasError > 0, - Day: day, - Keyword: params.Keyword, - Ip: params.Ip, - Domain: params.Domain, - Size: size, - Reverse: true, + RequestId: params.RequestId, + ServerId: params.ServerId, + HasError: params.HasError > 0, + HasFirewallPolicy: params.HasWAF > 0, + Day: day, + Keyword: params.Keyword, + Ip: params.Ip, + Domain: params.Domain, + Size: size, + Reverse: true, }) if err != nil { this.ErrorPage(err) diff --git a/web/public/js/components/server/http-access-log-search-box.js b/web/public/js/components/server/http-access-log-search-box.js index 95da17ed..dc0f668c 100644 --- a/web/public/js/components/server/http-access-log-search-box.js +++ b/web/public/js/components/server/http-access-log-search-box.js @@ -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: `