From db1a37e0c2d8dda2bd4a13392d0bdd389412a1c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Fri, 20 Nov 2020 16:36:03 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=93=8D=E4=BD=9C=E6=97=A5=E5=BF=97]=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=8B=A5=E5=B9=B2=E6=9F=A5=E8=AF=A2=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/web/actions/default/log/index.go | 24 +++++++++++--- web/views/@default/log/index.html | 38 +++++++++++++++++++++-- web/views/@default/log/index.js | 14 +++++++++ 3 files changed, 70 insertions(+), 6 deletions(-) create mode 100644 web/views/@default/log/index.js diff --git a/internal/web/actions/default/log/index.go b/internal/web/actions/default/log/index.go index e0feba8f..c1196453 100644 --- a/internal/web/actions/default/log/index.go +++ b/internal/web/actions/default/log/index.go @@ -17,8 +17,20 @@ func (this *IndexAction) Init() { this.Nav("log", "log", "") } -func (this *IndexAction) RunGet(params struct{}) { - countResp, err := this.RPC().LogRPC().CountLogs(this.AdminContext(), &pb.CountLogRequest{}) +func (this *IndexAction) RunGet(params struct { + DayFrom string + DayTo string + Keyword string +}) { + this.Data["dayFrom"] = params.DayFrom + this.Data["dayTo"] = params.DayTo + this.Data["keyword"] = params.Keyword + + countResp, err := this.RPC().LogRPC().CountLogs(this.AdminContext(), &pb.CountLogRequest{ + DayFrom: params.DayFrom, + DayTo: params.DayTo, + Keyword: params.Keyword, + }) if err != nil { this.ErrorPage(err) return @@ -28,8 +40,11 @@ func (this *IndexAction) RunGet(params struct{}) { this.Data["page"] = page.AsHTML() logsResp, err := this.RPC().LogRPC().ListLogs(this.AdminContext(), &pb.ListLogsRequest{ - Offset: page.Offset, - Size: page.Size, + Offset: page.Offset, + Size: page.Size, + DayFrom: params.DayFrom, + DayTo: params.DayTo, + Keyword: params.Keyword, }) if err != nil { this.ErrorPage(err) @@ -68,6 +83,7 @@ func (this *IndexAction) RunGet(params struct{}) { "type": log.Type, "ip": log.Ip, "region": regionName, + "action": log.Action, }) } this.Data["logs"] = logMaps diff --git a/web/views/@default/log/index.html b/web/views/@default/log/index.html index c8e5309a..d61044e1 100644 --- a/web/views/@default/log/index.html +++ b/web/views/@default/log/index.html @@ -1,10 +1,44 @@ {$layout} -

暂时还没有日志。

+{$var "header"} + + + + + + +{$end} + +
+
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+
+ +
+
+

暂时还没有日志。

+
- + diff --git a/web/views/@default/log/index.js b/web/views/@default/log/index.js new file mode 100644 index 00000000..da29e848 --- /dev/null +++ b/web/views/@default/log/index.js @@ -0,0 +1,14 @@ +Tea.context(function () { + this.$delay(function () { + teaweb.datepicker("day-from-picker") + teaweb.datepicker("day-to-picker") + }) + + this.logs.forEach(function (v) { + v.moreVisible = false + }) + + this.showMore = function (log) { + log.moreVisible = !log.moreVisible + } +}) \ No newline at end of file
{{log.createdTime}} | {{log.userName}} | {{log.ip}} | {{log.region}}{{log.createdTime}} | {{log.userName}} | {{log.ip}} | {{log.region}}   ...  {{log.action}}
{{log.description}}