From 487debfd1214ec935eb04e4e987ce36fb4f14df3 Mon Sep 17 00:00:00 2001 From: gaowei Date: Sat, 26 Feb 2022 20:07:19 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=20=E5=91=BD?= =?UTF-8?q?=E4=BB=A4=E6=90=9C=E7=B4=A2=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/models/task.go | 6 ++++++ internal/routers/task/task.go | 1 + web/vue/src/pages/task/list.vue | 6 +++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/internal/models/task.go b/internal/models/task.go index f9062f90b..75dbaef33 100644 --- a/internal/models/task.go +++ b/internal/models/task.go @@ -273,4 +273,10 @@ func (task *Task) parseWhere(session *xorm.Session, params CommonMap) { if ok && tag.(string) != "" { session.And("tag = ? ", tag) } + + // 通过命令查询 + command, ok := params["Command"] + if ok && command.(string) != "" { + session.And("t.command LIKE ?", "%"+command.(string)+"%") + } } diff --git a/internal/routers/task/task.go b/internal/routers/task/task.go index 42865a1d0..0c430240b 100644 --- a/internal/routers/task/task.go +++ b/internal/routers/task/task.go @@ -286,6 +286,7 @@ func parseQueryParams(ctx *macaron.Context) models.CommonMap { params["Name"] = ctx.QueryTrim("name") params["Protocol"] = ctx.QueryInt("protocol") params["Tag"] = ctx.QueryTrim("tag") + params["Command"] = ctx.QueryTrim("command") status := ctx.QueryInt("status") if status >= 0 { status -= 1 diff --git a/web/vue/src/pages/task/list.vue b/web/vue/src/pages/task/list.vue index 474fb0eb6..9232f7b8b 100644 --- a/web/vue/src/pages/task/list.vue +++ b/web/vue/src/pages/task/list.vue @@ -10,6 +10,9 @@ + + + @@ -203,7 +206,8 @@ export default { name: '', tag: '', host_id: '', - status: '' + status: '', + command: '' }, isAdmin: this.$store.getters.user.isAdmin, protocolList: [ From 0a36e4171af463171f173c21f086bbdad9929fa4 Mon Sep 17 00:00:00 2001 From: gaowei Date: Sat, 26 Feb 2022 20:14:30 +0800 Subject: [PATCH 2/2] =?UTF-8?q?opt:=20=E5=88=A0=E9=99=A4=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/models/task.go | 1 - 1 file changed, 1 deletion(-) diff --git a/internal/models/task.go b/internal/models/task.go index 75dbaef33..9c027642b 100644 --- a/internal/models/task.go +++ b/internal/models/task.go @@ -274,7 +274,6 @@ func (task *Task) parseWhere(session *xorm.Session, params CommonMap) { session.And("tag = ? ", tag) } - // 通过命令查询 command, ok := params["Command"] if ok && command.(string) != "" { session.And("t.command LIKE ?", "%"+command.(string)+"%")