From 74508e08209590f4d596b19068a1b2ee27030bb2 Mon Sep 17 00:00:00 2001 From: liuzx Date: Thu, 23 Dec 2021 14:51:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8C=89=E7=85=A7=E9=A1=B5=E9=9D=A2=E8=AE=BF?= =?UTF-8?q?=E9=97=AE=E9=87=8F=E7=BB=9F=E8=AE=A1=E4=BB=93=E5=BA=93=E8=AE=BF?= =?UTF-8?q?=E9=97=AE=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/repository/elk_pagedata.go | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/modules/repository/elk_pagedata.go b/modules/repository/elk_pagedata.go index 1454f0364..ecdbff078 100644 --- a/modules/repository/elk_pagedata.go +++ b/modules/repository/elk_pagedata.go @@ -21,7 +21,8 @@ type Fields struct { Format string `json:"format"` } type MatchPhrase struct { - Message string `json:"message"` + Message string `json:"message,omitempty"` + TagName string `json:"tagName.keyword,omitempty"` } type Should struct { MatchPhrase MatchPhrase `json:"match_phrase"` @@ -144,7 +145,7 @@ func ProjectViewInit(User string, Project string, Gte string, Lte string) (proje inputStruct.Batch[0].Request.Params.Body.Fields = make([]Fields, 1) inputStruct.Batch[0].Request.Params.Body.Fields[0].Field = setting.TimeField inputStruct.Batch[0].Request.Params.Body.Fields[0].Format = setting.ElkTimeFormat - inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.Filter = make([]Filter, 3) + inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.Filter = make([]Filter, 4) //限定查询时间 var timeRange Range timeRange.Timestamptest.Gte = Gte @@ -159,6 +160,24 @@ func ProjectViewInit(User string, Project string, Gte string, Lte string) (proje var projectName FilterMatchPhrase projectName.ProjectName = Project inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.Filter[2].FilterMatchPhrase = &projectName + //限定页面 + var bool Bool + bool.Should = make([]Should, 14) + bool.Should[0].MatchPhrase.TagName = "%{[request][3]}" + bool.Should[1].MatchPhrase.TagName = "datasets?type=0" + bool.Should[2].MatchPhrase.TagName = "datasets?type=1" + bool.Should[3].MatchPhrase.TagName = "issues" + bool.Should[4].MatchPhrase.TagName = "labels" + bool.Should[5].MatchPhrase.TagName = "pulls" + bool.Should[6].MatchPhrase.TagName = "wiki" + bool.Should[7].MatchPhrase.TagName = "activity" + bool.Should[8].MatchPhrase.TagName = "cloudbrain" + bool.Should[9].MatchPhrase.TagName = "modelarts" + bool.Should[10].MatchPhrase.TagName = "blockchain" + bool.Should[11].MatchPhrase.TagName = "watchers" + bool.Should[12].MatchPhrase.TagName = "stars" + bool.Should[13].MatchPhrase.TagName = "forks" + inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.Filter[3].Bool = &bool return inputStruct }