diff --git a/server/internal/handler/config.go b/server/internal/handler/config.go index b3e449a..82b1493 100644 --- a/server/internal/handler/config.go +++ b/server/internal/handler/config.go @@ -29,6 +29,7 @@ type ConfigListRequest struct { Env string `form:"env"` AppId *int `form:"appId"` Deleted bool `form:"deleted"` + Keyword string `form:"keyword"` } func (h *ConfigHandler) List(c *gin.Context) { @@ -59,6 +60,11 @@ func (h *ConfigHandler) List(c *gin.Context) { conditions = append(conditions, "env = ?") args = append(args, req.Env) } + if req.Keyword != "" { + like := "%" + req.Keyword + "%" + conditions = append(conditions, "(name LIKE ? OR contents LIKE ?)") + args = append(args, like, like) + } if req.AppId != nil { if *req.AppId <= 0 { conditions = append(conditions, "(app_id is null OR app_id = 0)") diff --git a/web/src/views/config/AllConfigList.vue b/web/src/views/config/AllConfigList.vue index da3d4ef..534d35b 100644 --- a/web/src/views/config/AllConfigList.vue +++ b/web/src/views/config/AllConfigList.vue @@ -2,6 +2,9 @@
+ + + @@ -253,7 +256,7 @@ export default { list: [], loading: false, total: 0, - query: { pageNo: 1, pageSize: 20, env: '', appId: null }, + query: { pageNo: 1, pageSize: 20, env: '', appId: null, keyword: '' }, profiles: [], apps: [], historyVisible: false, @@ -280,7 +283,7 @@ export default { this.loadData() }, handleReset() { - this.query = { pageNo: 1, pageSize: 20, env: '', appId: null } + this.query = { pageNo: 1, pageSize: 20, env: '', appId: null, keyword: '' } this.loadData() }, async loadData() { @@ -296,6 +299,9 @@ export default { if (this.query.appId) { params.appId = this.query.appId } + if (this.query.keyword) { + params.keyword = this.query.keyword + } const res = await getConfigList(params) this.list = res.data || [] this.total = res.total || 0 diff --git a/web/src/views/config/ConfigList.vue b/web/src/views/config/ConfigList.vue index 15aca04..3a23bda 100644 --- a/web/src/views/config/ConfigList.vue +++ b/web/src/views/config/ConfigList.vue @@ -2,6 +2,9 @@
+ + + @@ -248,7 +251,7 @@ export default { list: [], loading: false, total: 0, - query: { pageNo: 1, pageSize: 20, env: '' }, + query: { pageNo: 1, pageSize: 20, env: '', keyword: '' }, profiles: [], historyVisible: false, historyList: [], @@ -274,6 +277,7 @@ export default { }, handleReset() { this.query.env = '' + this.query.keyword = '' this.query.pageNo = 1 this.loadData() }, @@ -288,6 +292,9 @@ export default { if (this.query.env) { params.env = this.query.env } + if (this.query.keyword) { + params.keyword = this.query.keyword + } const res = await getConfigList(params) this.list = res.data || [] this.total = res.total || 0 diff --git a/web/src/views/config/RecycleBin.vue b/web/src/views/config/RecycleBin.vue index bd9969d..cb17a2c 100644 --- a/web/src/views/config/RecycleBin.vue +++ b/web/src/views/config/RecycleBin.vue @@ -2,6 +2,9 @@
+ + + @@ -61,7 +64,7 @@ export default { list: [], loading: false, total: 0, - query: { pageNo: 1, pageSize: 10, env: '', appId: null }, + query: { pageNo: 1, pageSize: 10, env: '', appId: null, keyword: '' }, profiles: [], apps: [] } @@ -77,7 +80,7 @@ export default { this.loadData() }, handleReset() { - this.query = { pageNo: 1, pageSize: 10, env: '', appId: null } + this.query = { pageNo: 1, pageSize: 10, env: '', appId: null, keyword: '' } this.loadData() }, async loadData() { @@ -94,6 +97,9 @@ export default { if (this.query.appId) { params.appId = this.query.appId } + if (this.query.keyword) { + params.keyword = this.query.keyword + } const res = await getConfigList(params) this.list = res.data || [] this.total = res.total || 0