From 5cf20579d2fd8aaf089276ea92235edf5a50d546 Mon Sep 17 00:00:00 2001 From: avadesian Date: Mon, 11 Oct 2021 15:22:11 +0800 Subject: [PATCH 01/22] add new feature fetch upstream --- options/locale/locale_en-US.ini | 4 ++++ options/locale/locale_zh-CN.ini | 4 ++++ routers/repo/view.go | 35 +++++++++++++++++++++++++++++++++++ templates/repo/home.tmpl | 11 +++++++++++ 4 files changed, 54 insertions(+) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 50e85ba27..5ea80af77 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1241,6 +1241,10 @@ pulls.reject_count_1 = "%d change request" pulls.reject_count_n = "%d change requests" pulls.waiting_count_1 = "%d waiting review" pulls.waiting_count_n = "%d waiting reviews" +pulls.commits_count_1=This branch is %d commit behind the upstream. +pulls.commits_count_n=This branch is %d commit behind the upstream. +pulls.fetch_upstream=Fetch upstream +pulls.upstream_up_to_date=No new commits to fetch pulls.no_merge_desc = This pull request cannot be merged because all repository merge options are disabled. pulls.no_merge_helper = Enable merge options in the repository settings or merge the pull request manually. diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index 89a6282e5..3774668bb 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -1243,6 +1243,10 @@ pulls.reject_count_1=%d 变更请求 pulls.reject_count_n=%d 变更请求 pulls.waiting_count_1=%d 个正在等待审核 pulls.waiting_count_n=%d 个正在等待审核 +pulls.commits_count_1=当前分支落后上游分支 %d 个提交 +pulls.commits_count_n=当前分支落后上游分支 %d 个提交 +pulls.fetch_upstream=拉取上游更新 +pulls.upstream_up_to_date=上游分支没有新的更新 pulls.no_merge_desc=由于未启用合并选项,此合并请求无法被合并。 pulls.no_merge_helper=在项目设置中启用合并选项或者手工合并请求。 diff --git a/routers/repo/view.go b/routers/repo/view.go index 1546f53b7..8c768c9eb 100644 --- a/routers/repo/view.go +++ b/routers/repo/view.go @@ -790,6 +790,41 @@ func renderCode(ctx *context.Context) { } } + //如果是fork的仓库 + if ctx.Repo.Repository.IsFork { + //获得fetchUpstream对应的分支参数 + /* + // 1. /{:baseOwner}/{:baseRepoName}/compare/{:baseBranch}...{:headBranch} + // 2. /{:baseOwner}/{:baseRepoName}/compare/{:baseBranch}...{:headOwner}:{:headBranch} + // 3. /{:baseOwner}/{:baseRepoName}/compare/{:baseBranch}...{:headOwner}/{:headRepoName}:{:headBranch} + */ + baseGitRepo, err := git.OpenRepository(ctx.Repo.Repository.BaseRepo.RepoPath()) + if err != nil { + log.Error("error open baseRepo:%s",ctx.Repo.Repository.BaseRepo.RepoPath()) + } + defer baseGitRepo.Close() + if _,error:= baseGitRepo.GetBranch(ctx.Repo.BranchName);error==nil{ + //base repo has the same branch, then compare between current repo branch and base repo's branch + compareUrl := ctx.Repo.BranchName + "..." + ctx.Repo.Repository.BaseRepo.OwnerName + "/" + ctx.Repo.Repository.BaseRepo.Name + ":" + ctx.Repo.BranchName + ctx.SetParams("*",compareUrl) + }else{ + //else, compare between current repo branch and base repo's default branch + compareUrl := ctx.Repo.BranchName + "..." + ctx.Repo.Repository.BaseRepo.OwnerName + "/" + ctx.Repo.Repository.BaseRepo.Name + ":" + ctx.Repo.Repository.BaseRepo.DefaultBranch + ctx.SetParams("*",compareUrl) + } + + _, _, headGitRepo, compareInfo, _, _ := ParseCompareInfo(ctx) + defer headGitRepo.Close() + if compareInfo!= nil { + if compareInfo.Commits!=nil { + log.Info("compareInfoCommits数量:%d",compareInfo.Commits.Len()) + ctx.Data["FetchUpstreamCnt"] = compareInfo.Commits.Len() + }else{ + log.Info("compareInfo nothing different") + ctx.Data["FetchUpstreamCnt"] = 0 + } + } + } ctx.Data["Paths"] = paths ctx.Data["TreeLink"] = treeLink ctx.Data["TreeNames"] = treeNames diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index b48efd498..2f123e473 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -119,6 +119,17 @@ + {{if and .Repository.IsFork .PullRequestCtx.Allowed}} + {{if gt .FetchUpstreamCnt 0 }} + + + + {{else}} + + + + {{end}} + {{end}} {{end}} {{else}} From d3b6d8355efeda0427a2047338f94b1c89e3a925 Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Tue, 12 Oct 2021 11:44:47 +0800 Subject: [PATCH 02/22] fix the issue about change the cloundbranin status --- templates/repo/cloudbrain/index.tmpl | 34 +++++++++++++++++++++++----------- web_src/less/openi.less | 8 ++++---- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/templates/repo/cloudbrain/index.tmpl b/templates/repo/cloudbrain/index.tmpl index f39e0605a..4021fde97 100755 --- a/templates/repo/cloudbrain/index.tmpl +++ b/templates/repo/cloudbrain/index.tmpl @@ -271,19 +271,28 @@
- + + {{.Status}} + + - {{if eq .Status "STOPPED"}} - 已停止 - {{else if eq .Status "RUNNING"}} - 运行中 - {{else if eq .Status "FAILED"}} - 运行失败 - {{else if eq .Status "WAITING"}} - 初始化等待 - {{end}} {{TimeSinceUnix .Cloudbrain.CreatedUnix $.Lang}}
@@ -456,15 +465,18 @@ $(document).ready(loadJobStatus); function loadJobStatus() { $(".job-status").each((index, job) => { + console.log("---------",index,job) const jobID = job.dataset.jobid; const repoPath = job.dataset.repopath; if (job.textContent.trim() == 'STOPPED') { + return } $.get(`/api/v1/repos/${repoPath}/cloudbrain/${jobID}`, (data) => { const jobID = data.JobID const status = data.JobStatus + console.log("status",status) if (status != job.textContent.trim()) { //$('#' + jobID).text(status) //if (status == 'STOPPED') { diff --git a/web_src/less/openi.less b/web_src/less/openi.less index 521515906..3230a725d 100644 --- a/web_src/less/openi.less +++ b/web_src/less/openi.less @@ -224,15 +224,15 @@ footer .column{margin-bottom:0!important; padding-bottom:0!important;} // icon cloudbrain .i-round{display:inline-block;width:18px;height:18px;background:url("/img/icons.svg");background-position: -496px -52px;} .i-bg-organ{background-position: -496px -52px;} -.i-bg-stop{background-position: -459px -52px;} -.i-bg-running{background-position: -478px -52px;} +.STOPPED{display:inline-block;width:18px;height:18px;background:url("/img/icons.svg");background-position: -496px -52px;background-position: -459px -52px;} +.RUNNING{display:inline-block;width:18px;height:18px;background:url("/img/icons.svg");background-position: -496px -52px;background-position: -478px -52px;} .i-bg-orange{background-position: -495px -51px;} -.i-bg-red{background-position: -532px -52px;} +.FAILED{display:inline-block;width:18px;height:18px;background:url("/img/icons.svg");background-position: -496px -52px;background-position: -532px -52px;} .i-bg-green{background-position: -441px -52px;} .i-bg-used{background-position: -514px -52px;} .icon-bind{background-position: -550px -52px;} .icon-unbind{background-position: -568px -52px;} -.showCircle{display:inline-block;background-image:url('/img/loading.gif');background-repeat:no-repeat;width:16px;height:16px;background-size:16px 16px;margin-right:5px;} +.WAITING{display:inline-block;background-image:url('/img/loading.gif');background-repeat:no-repeat;width:16px;height:16px;background-size:16px 16px;margin-right:5px;} .text_over{ overflow: hidden; text-overflow: ellipsis; From 01ccc47f55c471ee8ec13b58e391fa1ff68c5950 Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Tue, 12 Oct 2021 12:37:50 +0800 Subject: [PATCH 03/22] fix issue fix-327 --- templates/repo/issue/list.tmpl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index a99205eea..9c0be9a71 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -4,18 +4,19 @@
-
{{template "repo/issue/search" .}}
{{if not .Repository.IsArchived}}
- {{template "repo/issue/navbar" .}} + {{if .PageIsIssueList}} {{.i18n.Tr "repo.issues.new"}} {{else}} From e16ab13e1b7fe595fa667cd385ad408d62feb205 Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Tue, 12 Oct 2021 15:19:43 +0800 Subject: [PATCH 04/22] fix issue #487 --- web_src/js/components/EditTopics.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web_src/js/components/EditTopics.vue b/web_src/js/components/EditTopics.vue index c946dff47..5c452d76a 100644 --- a/web_src/js/components/EditTopics.vue +++ b/web_src/js/components/EditTopics.vue @@ -197,13 +197,13 @@ export default { }) }, postTopic(){ - const patter = /^[\u4e00-\u9fa5a-z0-9][\u4e00-\u9fa5a-zA-Z0-9-]{0,35}$/ + const patter = /^[\u4e00-\u9fa5a-zA-Z0-9][\u4e00-\u9fa5a-zA-Z0-9-]{0,34}$/ let regexp = patter.test(this.input) console.log("regexp",regexp) if(!regexp){ this.$notify({ - message: '主题必须以中文、字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符', + message: '标签名必须以中文、字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符', duration: 3000, type:'error' }); From 616aba813cee662f0abae1b1c42ee36bee4b70a8 Mon Sep 17 00:00:00 2001 From: Gitea Date: Tue, 12 Oct 2021 16:55:30 +0800 Subject: [PATCH 05/22] el --- models/elk_pagedata.go | 180 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100644 models/elk_pagedata.go diff --git a/models/elk_pagedata.go b/models/elk_pagedata.go new file mode 100644 index 000000000..2f5c241a8 --- /dev/null +++ b/models/elk_pagedata.go @@ -0,0 +1,180 @@ +package models + +import ( + "bytes" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" +) + +//输出的json结构begin +type Hits struct { + Total int `json:"total"` +} +type RawResponse struct { + Hits Hits `json:"hits"` +} +type Result struct { + RawResponse RawResponse `json:"rawResponse"` + Loaded int `json:"loaded"` +} +type ResultInfo struct { + Id int `json:"id"` + Result Result `json:"result"` +} + +//输出的json结构end + +// //输入的json结构end +type InputInfo struct { + Batch []Batch `json:"batch"` +} +type Fields struct { + Field string `json:"field"` + Format string `json:"format"` +} +type MatchPhrase struct { + Message string `json:"message"` +} +type Should struct { + MatchPhrase MatchPhrase `json:"match_phrase"` +} +type Bool struct { + Should []Should `json:"should"` + MinimumShouldMatch int `json:"minimum_should_match"` +} +type Timestamptest struct { + // Gte time.Time `json:"gte"` + Gte string `json:"gte"` + Lte string `json:"lte"` + Format string `json:"format"` +} +type Range struct { + Timestamptest Timestamptest `json:"@timestamptest"` +} + +type FilterMatchPhrase struct { + UserName string `json:"userName.keyword,omitempty"` + ProjectName string `json:"projectName.keyword,omitempty"` +} + +type Filter struct { + Bool *Bool `json:"bool,omitempty"` + Range *Range `json:"range,omitempty"` + FilterMatchPhrase *FilterMatchPhrase `json:"match_phrase,omitempty"` +} +type MatchPhraseIn struct { + ProjectName string `json:"projectName"` +} +type MustNot struct { + MatchPhraseIn MatchPhraseIn `json:"match_phrase"` +} +type BoolIn struct { + Filter []Filter `json:"filter"` + MustNot []MustNot `json:"must_not"` +} +type Query struct { + BoolIn BoolIn `json:"bool"` +} +type Body struct { + Size int `json:"size"` + Fields []Fields `json:"fields"` + Query Query `json:"query"` +} +type Params struct { + Index string `json:"index"` + Body Body `json:"body"` +} +type Request struct { + Params Params `json:"params"` +} +type Batch struct { + Request Request `json:"request"` +} + +func SendData(jsonStr []byte) (content string) { + url := "http://192.168.207.35:5601/internal/bsearch" + req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr)) + req.Header.Set("Content-Type", "application/json") + req.Header.Set("kbn-version", "7.13.2") + req.Header.Set("Authorization", "Basic cWl6aGk6UGNsMjAyMA==") + client := &http.Client{} + resp, err := client.Do(req) + if err != nil { + panic(err) + } + defer resp.Body.Close() + body, _ := ioutil.ReadAll(resp.Body) + return string(body) +} + +func getdata(resultinfo ResultInfo, jobResult string) (value1 int, value2 int) { + var resultTest ResultInfo + errs := json.Unmarshal([]byte(jobResult), &resultTest) + fmt.Println(errs) + return resultTest.Result.Loaded, resultTest.Result.RawResponse.Hits.Total +} + +func inputStructInit(User string, Project string, Gte string, Lte string) (inputStructInit InputInfo) { + var inputStruct InputInfo + inputStruct.Batch = make([]Batch, 1) + inputStruct.Batch[0].Request.Params.Index = "filebeat-7.3.2*" + inputStruct.Batch[0].Request.Params.Body.Size = 0 + inputStruct.Batch[0].Request.Params.Body.Fields = make([]Fields, 1) + inputStruct.Batch[0].Request.Params.Body.Fields[0].Field = "@timestamptest" + inputStruct.Batch[0].Request.Params.Body.Fields[0].Format = "date_time" + inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.Filter = make([]Filter, 3) + + var timeRange Range + timeRange.Timestamptest.Gte = Gte + timeRange.Timestamptest.Lte = Lte + timeRange.Timestamptest.Format = "strict_date_optional_time" + inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.Filter[0].Range = &timeRange + + var userName FilterMatchPhrase + userName.UserName = User + inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.Filter[1].FilterMatchPhrase = &userName + + var projectName FilterMatchPhrase + projectName.ProjectName = Project + inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.Filter[2].FilterMatchPhrase = &projectName + + return inputStruct +} + +// @title ProjectViewData +// @description 获取指定用户和项目的访问量 +// @param User string "用户名" +// @param Project string "项目名" +// @param Gte string "起始时间" 如 time.Now().AddDate(0, 0, -1).Format(time.RFC3339) +// @param Lte string "结束时间" 如 time.Now().Format(time.RFC3339) +// @return value int "访问量" +func ProjectViewData(User string, Project string, Gte string, Lte string) (value int) { + InitInfo := inputStructInit(User, Project, Gte, Lte) + jsons, errs := json.Marshal(InitInfo) + if errs != nil { + fmt.Println("errs:", errs.Error()) + } + var jsonStr = []byte(jsons) + var resultTest ResultInfo + loaded, total := getdata(resultTest, SendData(jsonStr)) + time := 0 + for { + if loaded == 0 { + value1, total := getdata(resultTest, SendData(jsonStr)) + time++ + if value1 != 0 && time < 100 { + fmt.Println("total:", total) + return total + } + if time > 100 { + break + } + } else { + break + } + } + fmt.Println("loaded:", loaded) + return total +} From 400b1bd1a620c165acfd86dc81aac4be4d8a2c06 Mon Sep 17 00:00:00 2001 From: Gitea Date: Tue, 12 Oct 2021 17:10:04 +0800 Subject: [PATCH 06/22] elk --- models/elk_pagedata.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/models/elk_pagedata.go b/models/elk_pagedata.go index 2f5c241a8..a0f7f3ca0 100644 --- a/models/elk_pagedata.go +++ b/models/elk_pagedata.go @@ -93,7 +93,7 @@ type Batch struct { Request Request `json:"request"` } -func SendData(jsonStr []byte) (content string) { +func sendData(jsonStr []byte) (content string) { url := "http://192.168.207.35:5601/internal/bsearch" req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr)) req.Header.Set("Content-Type", "application/json") @@ -109,7 +109,7 @@ func SendData(jsonStr []byte) (content string) { return string(body) } -func getdata(resultinfo ResultInfo, jobResult string) (value1 int, value2 int) { +func getData(resultinfo ResultInfo, jobResult string) (value1 int, value2 int) { var resultTest ResultInfo errs := json.Unmarshal([]byte(jobResult), &resultTest) fmt.Println(errs) @@ -143,14 +143,14 @@ func inputStructInit(User string, Project string, Gte string, Lte string) (input return inputStruct } -// @title ProjectViewData +// @title projectViewData // @description 获取指定用户和项目的访问量 // @param User string "用户名" // @param Project string "项目名" // @param Gte string "起始时间" 如 time.Now().AddDate(0, 0, -1).Format(time.RFC3339) // @param Lte string "结束时间" 如 time.Now().Format(time.RFC3339) // @return value int "访问量" -func ProjectViewData(User string, Project string, Gte string, Lte string) (value int) { +func projectViewData(User string, Project string, Gte string, Lte string) (value int) { InitInfo := inputStructInit(User, Project, Gte, Lte) jsons, errs := json.Marshal(InitInfo) if errs != nil { @@ -158,11 +158,11 @@ func ProjectViewData(User string, Project string, Gte string, Lte string) (value } var jsonStr = []byte(jsons) var resultTest ResultInfo - loaded, total := getdata(resultTest, SendData(jsonStr)) + loaded, total := getData(resultTest, sendData(jsonStr)) time := 0 for { if loaded == 0 { - value1, total := getdata(resultTest, SendData(jsonStr)) + value1, total := getData(resultTest, sendData(jsonStr)) time++ if value1 != 0 && time < 100 { fmt.Println("total:", total) From 0726f97ceb30faf9e828c173ef01adee11ca5431 Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Tue, 12 Oct 2021 17:29:27 +0800 Subject: [PATCH 07/22] fix issue #327 about navbar right --- templates/repo/issue/list.tmpl | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index 9c0be9a71..e7cb8b19f 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -3,20 +3,14 @@ {{template "repo/header" .}}
-
- - {{template "repo/issue/navbar" .}} +
{{template "repo/issue/search" .}}
{{if not .Repository.IsArchived}}
- + {{template "repo/issue/navbar" .}} {{if .PageIsIssueList}} {{.i18n.Tr "repo.issues.new"}} {{else}} From 6e660c868eaf4eb4e4b270f7f8a87e46f44c32ab Mon Sep 17 00:00:00 2001 From: avadesian Date: Tue, 12 Oct 2021 17:44:44 +0800 Subject: [PATCH 08/22] =?UTF-8?q?=E5=A4=84=E7=90=86=E6=8B=89=E5=8F=96?= =?UTF-8?q?=E4=B8=8A=E6=B8=B8=E5=88=86=E6=94=AF=E6=9B=B4=E6=96=B0=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- options/locale/locale_en-US.ini | 3 ++- options/locale/locale_zh-CN.ini | 1 + routers/repo/view.go | 41 ++++++++++++++++++++++------------------- templates/repo/home.tmpl | 4 ++++ 4 files changed, 29 insertions(+), 20 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 52e3a50ce..141a6dd65 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -87,7 +87,7 @@ write = Write preview = Preview loading = Loading… -error404_index = Request forbidden by administrative rules +error404_index = Request forbidden by administrative rules error500_index = Internal Server Error error404 = The page you are trying to reach either does not exist or you are not authorized to view it. error500= Sorry, the site has encountered some problems, we are trying to fix the page, please try again later. @@ -1247,6 +1247,7 @@ pulls.commits_count_1=This branch is %d commit behind the upstream. pulls.commits_count_n=This branch is %d commit behind the upstream. pulls.fetch_upstream=Fetch upstream pulls.upstream_up_to_date=No new commits to fetch +pulls.upstream_error=Cannot get upstream info pulls.no_merge_desc = This pull request cannot be merged because all repository merge options are disabled. pulls.no_merge_helper = Enable merge options in the repository settings or merge the pull request manually. diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index 397bcbdb8..5cb62d823 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -1249,6 +1249,7 @@ pulls.commits_count_1=当前分支落后上游分支 %d 个提交 pulls.commits_count_n=当前分支落后上游分支 %d 个提交 pulls.fetch_upstream=拉取上游更新 pulls.upstream_up_to_date=上游分支没有新的更新 +pulls.upstream_error=获取上游分支信息错误 pulls.no_merge_desc=由于未启用合并选项,此合并请求无法被合并。 pulls.no_merge_helper=在项目设置中启用合并选项或者手工合并请求。 diff --git a/routers/repo/view.go b/routers/repo/view.go index 8c768c9eb..0d284c42b 100644 --- a/routers/repo/view.go +++ b/routers/repo/view.go @@ -799,29 +799,32 @@ func renderCode(ctx *context.Context) { // 3. /{:baseOwner}/{:baseRepoName}/compare/{:baseBranch}...{:headOwner}/{:headRepoName}:{:headBranch} */ baseGitRepo, err := git.OpenRepository(ctx.Repo.Repository.BaseRepo.RepoPath()) + defer baseGitRepo.Close() if err != nil { log.Error("error open baseRepo:%s",ctx.Repo.Repository.BaseRepo.RepoPath()) - } - defer baseGitRepo.Close() - if _,error:= baseGitRepo.GetBranch(ctx.Repo.BranchName);error==nil{ - //base repo has the same branch, then compare between current repo branch and base repo's branch - compareUrl := ctx.Repo.BranchName + "..." + ctx.Repo.Repository.BaseRepo.OwnerName + "/" + ctx.Repo.Repository.BaseRepo.Name + ":" + ctx.Repo.BranchName - ctx.SetParams("*",compareUrl) + ctx.Data["FetchUpstreamCnt"] = -1 // minus value indicates error }else{ - //else, compare between current repo branch and base repo's default branch - compareUrl := ctx.Repo.BranchName + "..." + ctx.Repo.Repository.BaseRepo.OwnerName + "/" + ctx.Repo.Repository.BaseRepo.Name + ":" + ctx.Repo.Repository.BaseRepo.DefaultBranch - ctx.SetParams("*",compareUrl) - } - - _, _, headGitRepo, compareInfo, _, _ := ParseCompareInfo(ctx) - defer headGitRepo.Close() - if compareInfo!= nil { - if compareInfo.Commits!=nil { - log.Info("compareInfoCommits数量:%d",compareInfo.Commits.Len()) - ctx.Data["FetchUpstreamCnt"] = compareInfo.Commits.Len() + if _,error:= baseGitRepo.GetBranch(ctx.Repo.BranchName);error==nil{ + //base repo has the same branch, then compare between current repo branch and base repo's branch + compareUrl := ctx.Repo.BranchName + "..." + ctx.Repo.Repository.BaseRepo.OwnerName + "/" + ctx.Repo.Repository.BaseRepo.Name + ":" + ctx.Repo.BranchName + ctx.SetParams("*",compareUrl) + }else{ + //else, compare between current repo branch and base repo's default branch + compareUrl := ctx.Repo.BranchName + "..." + ctx.Repo.Repository.BaseRepo.OwnerName + "/" + ctx.Repo.Repository.BaseRepo.Name + ":" + ctx.Repo.Repository.BaseRepo.DefaultBranch + ctx.SetParams("*",compareUrl) + } + _, _, headGitRepo, compareInfo, _, _ := ParseCompareInfo(ctx) + defer headGitRepo.Close() + if compareInfo!= nil { + if compareInfo.Commits!=nil { + log.Info("compareInfoCommits数量:%d",compareInfo.Commits.Len()) + ctx.Data["FetchUpstreamCnt"] = compareInfo.Commits.Len() + }else{ + log.Info("compareInfo nothing different") + ctx.Data["FetchUpstreamCnt"] = 0 + } }else{ - log.Info("compareInfo nothing different") - ctx.Data["FetchUpstreamCnt"] = 0 + ctx.Data["FetchUpstreamCnt"] = -1 // minus value indicates error } } } diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index d4a880647..8d52f9115 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -159,6 +159,10 @@ + {{else if lt .FetchUpstreamCnt 0}} + + + {{else}} From b99d5b3ed9d387335c0db74e4fe32714a04fe540 Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Wed, 13 Oct 2021 11:37:12 +0800 Subject: [PATCH 09/22] =?UTF-8?q?fix=20428=E5=90=8E=E7=AB=AF=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=90=88=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/repo_list.go | 14 ++++++++++++++ routers/home.go | 5 ++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/models/repo_list.go b/models/repo_list.go index 57b6ebbd6..928e1f953 100755 --- a/models/repo_list.go +++ b/models/repo_list.go @@ -166,6 +166,8 @@ type SearchRepoOptions struct { Archived util.OptionalBool // only search topic name TopicOnly bool + //search by Specific TopicName + TopicName string // include description in keyword search IncludeDescription bool // None -> include has milestones AND has no milestone @@ -327,6 +329,18 @@ func SearchRepositoryCondition(opts *SearchRepoOptions) builder.Cond { } cond = cond.And(keywordCond) } + if opts.TopicName != "" { + var subQueryCond = builder.NewCond() + subQueryCond = subQueryCond.Or(builder.Eq{"topic.name": opts.TopicName}) + subQuery := builder.Select("repo_topic.repo_id").From("repo_topic"). + Join("INNER", "topic", "topic.id = repo_topic.topic_id"). + Where(subQueryCond). + GroupBy("repo_topic.repo_id") + + var topicNameCond = builder.In("id", subQuery) + cond = cond.And(topicNameCond) + + } if opts.Fork != util.OptionalBoolNone { cond = cond.And(builder.Eq{"is_fork": opts.Fork == util.OptionalBoolTrue}) diff --git a/routers/home.go b/routers/home.go index a1c07e317..b36501d32 100755 --- a/routers/home.go +++ b/routers/home.go @@ -149,8 +149,7 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) { //todo:support other topics keyword := strings.Trim(ctx.Query("q"), " ") - topicOnly := ctx.QueryBool("topic") - ctx.Data["TopicOnly"] = topicOnly + topic := strings.Trim(ctx.Query("topic"), " ") repos, count, err = models.SearchRepository(&models.SearchRepoOptions{ ListOptions: models.ListOptions{ @@ -164,7 +163,7 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) { OwnerID: opts.OwnerID, AllPublic: true, AllLimited: true, - TopicOnly: topicOnly, + TopicName: topic, IncludeDescription: setting.UI.SearchRepoDescription, }) if err != nil { From 352acdb8d1a3826242204e7797722e6eadcef64a Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Wed, 13 Oct 2021 12:41:40 +0800 Subject: [PATCH 10/22] fix issue fix-455 --- options/locale/locale_en-US.ini | 3 +++ options/locale/locale_zh-CN.ini | 3 +++ templates/repo/cloudbrain/index.tmpl | 47 +++++++++++++++++++++++++----------- 3 files changed, 39 insertions(+), 14 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index bf7be287d..464542cc7 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -771,6 +771,9 @@ cloudbrain_platform_selection = Select the cloudbrain platform you want to use: confirm_choice = confirm cloudbran1_tips = Only data in zip format can create cloudbrain tasks cloudbrain_creator=Creator +cloudbrain_task = Task Name +cloudbrain_operate = Operate +cloudbrain_status_createtime = Status/Createtime template.items = Template Items template.git_content = Git Content (Default Branch) diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index 04b3c2e59..b8f416a35 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -773,6 +773,9 @@ cloudbrain_platform_selection=选择您准备使用的云脑平台: confirm_choice=确定 cloudbran1_tips=只有zip格式的数据集才能发起云脑任务 cloudbrain_creator=创建者 +cloudbrain_task=任务名称 +cloudbrain_operate=操作 +cloudbrain_status_createtime=状态/创建时间 template.items=模板选项 template.git_content=Git数据(默认分支) diff --git a/templates/repo/cloudbrain/index.tmpl b/templates/repo/cloudbrain/index.tmpl index 4021fde97..495daa411 100755 --- a/templates/repo/cloudbrain/index.tmpl +++ b/templates/repo/cloudbrain/index.tmpl @@ -241,31 +241,51 @@
-
+ +
-
+
--> + +
+
+
+
+ {{$.i18n.Tr "repo.cloudbrain_task"}} +
+
+ {{$.i18n.Tr "repo.cloudbrain_status_createtime"}} +
+
+ {{$.i18n.Tr "repo.cloudbrain_creator"}} +
+
+ {{$.i18n.Tr "repo.cloudbrain_operate"}} +
+ +
+ +
{{range .Tasks}}
@@ -279,7 +299,7 @@ {{else}} {{.Status}} {{end}} --> - {{.Status}} + {{.Status}} - {{TimeSinceUnix .Cloudbrain.CreatedUnix $.Lang}} + {{TimeSinceUnix .Cloudbrain.CreatedUnix $.Lang}}
-
- {{$.i18n.Tr "repo.cloudbrain_creator"}}{{.User.Name}} - +
+
-
-
+
+
{{if and (ne .Status "WAITING") (ne .JobType "DEBUG")}} 评分 From aaa476414349cf85832f67eed23c3548426b22c0 Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Wed, 13 Oct 2021 15:30:42 +0800 Subject: [PATCH 11/22] =?UTF-8?q?=E5=A2=9E=E5=8A=A0topic=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routers/home.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/routers/home.go b/routers/home.go index b36501d32..70fea437c 100755 --- a/routers/home.go +++ b/routers/home.go @@ -176,6 +176,8 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) { repo.Active = int64(repo.NumIssues) + int64(repo.NumPulls) + int64(repo.NumCommit) } ctx.Data["Keyword"] = keyword + ctx.Data["Topic"] = topic + ctx.Data["Total"] = count ctx.Data["Repos"] = repos ctx.Data["IsRepoIndexerEnabled"] = setting.Indexer.RepoIndexerEnabled From 895739e48c0710e41ab7413bc01cf3c615f89ce8 Mon Sep 17 00:00:00 2001 From: Gitea Date: Wed, 13 Oct 2021 16:43:23 +0800 Subject: [PATCH 12/22] elk_projectView --- models/elk_pagedata.go | 180 --------------------- modules/repository/elk_pagedata.go | 309 +++++++++++++++++++++++++++++++++++++ 2 files changed, 309 insertions(+), 180 deletions(-) delete mode 100644 models/elk_pagedata.go create mode 100644 modules/repository/elk_pagedata.go diff --git a/models/elk_pagedata.go b/models/elk_pagedata.go deleted file mode 100644 index a0f7f3ca0..000000000 --- a/models/elk_pagedata.go +++ /dev/null @@ -1,180 +0,0 @@ -package models - -import ( - "bytes" - "encoding/json" - "fmt" - "io/ioutil" - "net/http" -) - -//输出的json结构begin -type Hits struct { - Total int `json:"total"` -} -type RawResponse struct { - Hits Hits `json:"hits"` -} -type Result struct { - RawResponse RawResponse `json:"rawResponse"` - Loaded int `json:"loaded"` -} -type ResultInfo struct { - Id int `json:"id"` - Result Result `json:"result"` -} - -//输出的json结构end - -// //输入的json结构end -type InputInfo struct { - Batch []Batch `json:"batch"` -} -type Fields struct { - Field string `json:"field"` - Format string `json:"format"` -} -type MatchPhrase struct { - Message string `json:"message"` -} -type Should struct { - MatchPhrase MatchPhrase `json:"match_phrase"` -} -type Bool struct { - Should []Should `json:"should"` - MinimumShouldMatch int `json:"minimum_should_match"` -} -type Timestamptest struct { - // Gte time.Time `json:"gte"` - Gte string `json:"gte"` - Lte string `json:"lte"` - Format string `json:"format"` -} -type Range struct { - Timestamptest Timestamptest `json:"@timestamptest"` -} - -type FilterMatchPhrase struct { - UserName string `json:"userName.keyword,omitempty"` - ProjectName string `json:"projectName.keyword,omitempty"` -} - -type Filter struct { - Bool *Bool `json:"bool,omitempty"` - Range *Range `json:"range,omitempty"` - FilterMatchPhrase *FilterMatchPhrase `json:"match_phrase,omitempty"` -} -type MatchPhraseIn struct { - ProjectName string `json:"projectName"` -} -type MustNot struct { - MatchPhraseIn MatchPhraseIn `json:"match_phrase"` -} -type BoolIn struct { - Filter []Filter `json:"filter"` - MustNot []MustNot `json:"must_not"` -} -type Query struct { - BoolIn BoolIn `json:"bool"` -} -type Body struct { - Size int `json:"size"` - Fields []Fields `json:"fields"` - Query Query `json:"query"` -} -type Params struct { - Index string `json:"index"` - Body Body `json:"body"` -} -type Request struct { - Params Params `json:"params"` -} -type Batch struct { - Request Request `json:"request"` -} - -func sendData(jsonStr []byte) (content string) { - url := "http://192.168.207.35:5601/internal/bsearch" - req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr)) - req.Header.Set("Content-Type", "application/json") - req.Header.Set("kbn-version", "7.13.2") - req.Header.Set("Authorization", "Basic cWl6aGk6UGNsMjAyMA==") - client := &http.Client{} - resp, err := client.Do(req) - if err != nil { - panic(err) - } - defer resp.Body.Close() - body, _ := ioutil.ReadAll(resp.Body) - return string(body) -} - -func getData(resultinfo ResultInfo, jobResult string) (value1 int, value2 int) { - var resultTest ResultInfo - errs := json.Unmarshal([]byte(jobResult), &resultTest) - fmt.Println(errs) - return resultTest.Result.Loaded, resultTest.Result.RawResponse.Hits.Total -} - -func inputStructInit(User string, Project string, Gte string, Lte string) (inputStructInit InputInfo) { - var inputStruct InputInfo - inputStruct.Batch = make([]Batch, 1) - inputStruct.Batch[0].Request.Params.Index = "filebeat-7.3.2*" - inputStruct.Batch[0].Request.Params.Body.Size = 0 - inputStruct.Batch[0].Request.Params.Body.Fields = make([]Fields, 1) - inputStruct.Batch[0].Request.Params.Body.Fields[0].Field = "@timestamptest" - inputStruct.Batch[0].Request.Params.Body.Fields[0].Format = "date_time" - inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.Filter = make([]Filter, 3) - - var timeRange Range - timeRange.Timestamptest.Gte = Gte - timeRange.Timestamptest.Lte = Lte - timeRange.Timestamptest.Format = "strict_date_optional_time" - inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.Filter[0].Range = &timeRange - - var userName FilterMatchPhrase - userName.UserName = User - inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.Filter[1].FilterMatchPhrase = &userName - - var projectName FilterMatchPhrase - projectName.ProjectName = Project - inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.Filter[2].FilterMatchPhrase = &projectName - - return inputStruct -} - -// @title projectViewData -// @description 获取指定用户和项目的访问量 -// @param User string "用户名" -// @param Project string "项目名" -// @param Gte string "起始时间" 如 time.Now().AddDate(0, 0, -1).Format(time.RFC3339) -// @param Lte string "结束时间" 如 time.Now().Format(time.RFC3339) -// @return value int "访问量" -func projectViewData(User string, Project string, Gte string, Lte string) (value int) { - InitInfo := inputStructInit(User, Project, Gte, Lte) - jsons, errs := json.Marshal(InitInfo) - if errs != nil { - fmt.Println("errs:", errs.Error()) - } - var jsonStr = []byte(jsons) - var resultTest ResultInfo - loaded, total := getData(resultTest, sendData(jsonStr)) - time := 0 - for { - if loaded == 0 { - value1, total := getData(resultTest, sendData(jsonStr)) - time++ - if value1 != 0 && time < 100 { - fmt.Println("total:", total) - return total - } - if time > 100 { - break - } - } else { - break - } - } - fmt.Println("loaded:", loaded) - return total -} diff --git a/modules/repository/elk_pagedata.go b/modules/repository/elk_pagedata.go new file mode 100644 index 000000000..fa4b61beb --- /dev/null +++ b/modules/repository/elk_pagedata.go @@ -0,0 +1,309 @@ +package repository + +import ( + "bytes" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" +) + +//输入elk的json结构begin +type InputInfo struct { + Batch []Batch `json:"batch"` +} +type Fields struct { + Field string `json:"field"` + Format string `json:"format"` +} +type MatchPhrase struct { + Message string `json:"message"` +} +type Should struct { + MatchPhrase MatchPhrase `json:"match_phrase"` +} +type Bool struct { + Should []Should `json:"should"` + MinimumShouldMatch int `json:"minimum_should_match"` +} +type Timestamptest struct { + // Gte time.Time `json:"gte"` + Gte string `json:"gte"` + Lte string `json:"lte"` + Format string `json:"format"` +} +type Range struct { + Timestamptest Timestamptest `json:"@timestamptest"` +} + +type FilterMatchPhrase struct { + UserName string `json:"userName.keyword,omitempty"` + ProjectName string `json:"projectName.keyword,omitempty"` + TagName string `json:"tagName.keyword,omitempty"` +} + +type Filter struct { + Bool *Bool `json:"bool,omitempty"` + Range *Range `json:"range,omitempty"` + FilterMatchPhrase *FilterMatchPhrase `json:"match_phrase,omitempty"` +} +type MustNotMatchPhrase struct { + ProjectName string `json:"projectName"` +} +type MustNot struct { + MustNotMatchPhrase MustNotMatchPhrase `json:"match_phrase"` +} +type BoolIn struct { + Filter []Filter `json:"filter"` + MustNot []MustNot `json:"must_not"` +} +type Query struct { + BoolIn BoolIn `json:"bool"` +} +type Body struct { + Size int `json:"size"` + Fields []Fields `json:"fields"` + Query Query `json:"query"` +} +type Params struct { + Index string `json:"index"` + Body Body `json:"body"` +} +type Request struct { + Params Params `json:"params"` +} +type Batch struct { + Request Request `json:"request"` +} + +//输入elk的json结构end + +//elk输出的json结构begin +type Hits struct { + Total int `json:"total"` +} +type RawResponse struct { + Hits Hits `json:"hits"` +} +type Result struct { + RawResponse RawResponse `json:"rawResponse"` + Loaded int `json:"loaded"` +} +type ResultInfo struct { + Id int `json:"id"` + Result Result `json:"result"` +} + +//elk输出的json结构end + +//发送post请求到elk +func SendReqToElk(jsonStr []byte) (content string) { + url := "http://192.168.207.35:5601/internal/bsearch" + req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr)) + req.Header.Set("Content-Type", "application/json") + req.Header.Set("kbn-version", "7.13.2") + req.Header.Set("Authorization", "Basic cWl6aGk6UGNsMjAyMA==") + + client := &http.Client{} + resp, err := client.Do(req) + if err != nil { + panic(err) + } + defer resp.Body.Close() + body, _ := ioutil.ReadAll(resp.Body) + return string(body) +} + +//处理返回的elk数据,只保留totalView,即访问量;loaded是分片载入次数,用来判断返回的数据是否准确 +func GetResultFromElk(resultinfo ResultInfo, jobResult string) (loaded int, totalView int) { + var resultTest ResultInfo + errs := json.Unmarshal([]byte(jobResult), &resultTest) + fmt.Println(errs) + return resultTest.Result.Loaded, resultTest.Result.RawResponse.Hits.Total +} + +//初始化传给elk的数据结构,给定用户名和项目名,查询的起止时间,返回初始化后的结构 +func ProjectViewInit(User string, Project string, Gte string, Lte string) (projectViewInit InputInfo) { + var inputStruct InputInfo + inputStruct.Batch = make([]Batch, 1) + inputStruct.Batch[0].Request.Params.Index = "filebeat-7.3.2*" + inputStruct.Batch[0].Request.Params.Body.Size = 0 + inputStruct.Batch[0].Request.Params.Body.Fields = make([]Fields, 1) + inputStruct.Batch[0].Request.Params.Body.Fields[0].Field = "@timestamptest" + inputStruct.Batch[0].Request.Params.Body.Fields[0].Format = "date_time" + inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.Filter = make([]Filter, 3) + //限定查询时间 + var timeRange Range + timeRange.Timestamptest.Gte = Gte + timeRange.Timestamptest.Lte = Lte + timeRange.Timestamptest.Format = "strict_date_optional_time" + inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.Filter[0].Range = &timeRange + //限定用户 + var userName FilterMatchPhrase + userName.UserName = User + inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.Filter[1].FilterMatchPhrase = &userName + //限定项目 + var projectName FilterMatchPhrase + projectName.ProjectName = Project + inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.Filter[2].FilterMatchPhrase = &projectName + return inputStruct +} + +//初始化传给elk的数据结构,给定查询信息和非项目名,查询的起止时间,返回初始化后的结构 +func AllProjectViewInit(MessageInfo string, NotProject string, Gte string, Lte string) (allProjectViewInit InputInfo) { + var inputStruct InputInfo + inputStruct.Batch = make([]Batch, 1) + inputStruct.Batch[0].Request.Params.Index = "filebeat-7.3.2*" + inputStruct.Batch[0].Request.Params.Body.Size = 0 + inputStruct.Batch[0].Request.Params.Body.Fields = make([]Fields, 1) + inputStruct.Batch[0].Request.Params.Body.Fields[0].Field = "@timestamptest" + inputStruct.Batch[0].Request.Params.Body.Fields[0].Format = "date_time" + inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.Filter = make([]Filter, 2) + //限定message + var bool Bool + bool.Should = make([]Should, 1) + bool.Should[0].MatchPhrase.Message = MessageInfo + bool.MinimumShouldMatch = 1 + inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.Filter[0].Bool = &bool + //限定查询时间 + var timeRange Range + timeRange.Timestamptest.Gte = Gte + timeRange.Timestamptest.Lte = Lte + timeRange.Timestamptest.Format = "strict_date_optional_time" + inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.Filter[1].Range = &timeRange + //限定非项目 + // var boolIn BoolIn + inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.MustNot = make([]MustNot, 1) + inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.MustNot[0].MustNotMatchPhrase.ProjectName = NotProject + return inputStruct +} + +//初始化传给elk的数据结构,给定查询信息和tagName,查询的起止时间,返回初始化后的结构 +func TagNameInit(MessageInfo string, Tagname string, Gte string, Lte string) (projectViewInit InputInfo) { + var inputStruct InputInfo + inputStruct.Batch = make([]Batch, 1) + inputStruct.Batch[0].Request.Params.Index = "filebeat-7.3.2*" + inputStruct.Batch[0].Request.Params.Body.Size = 0 + inputStruct.Batch[0].Request.Params.Body.Fields = make([]Fields, 1) + inputStruct.Batch[0].Request.Params.Body.Fields[0].Field = "@timestamptest" + inputStruct.Batch[0].Request.Params.Body.Fields[0].Format = "date_time" + inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.Filter = make([]Filter, 3) + //限定message + var bool Bool + bool.Should = make([]Should, 1) + bool.Should[0].MatchPhrase.Message = MessageInfo + bool.MinimumShouldMatch = 1 + inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.Filter[0].Bool = &bool + //限定tagName + var tagName FilterMatchPhrase + tagName.TagName = Tagname + inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.Filter[1].FilterMatchPhrase = &tagName + //限定查询时间 + var timeRange Range + timeRange.Timestamptest.Gte = Gte + timeRange.Timestamptest.Lte = Lte + timeRange.Timestamptest.Format = "strict_date_optional_time" + inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.Filter[2].Range = &timeRange + return inputStruct +} + +//向elk发送请求,将获取的结果只保留访问量,输入是初始化后的数据结构,返回访问量 +func ViewInfo(viewInfo InputInfo) (totalView int) { + jsons, errs := json.Marshal(viewInfo) + if errs != nil { + fmt.Println("errs:", errs.Error()) + } + // fmt.Println("viewInfoInit:",string(jsons)) + var jsonStr = []byte(jsons) + var resultInfo ResultInfo + loaded, totalView := GetResultFromElk(resultInfo, SendReqToElk(jsonStr)) + time := 0 + for { + if loaded == 0 { + loaded_next, totalView := GetResultFromElk(resultInfo, SendReqToElk(jsonStr)) + time++ + if loaded_next != 0 && time < 100 { + fmt.Println("totalView:", totalView) + return totalView + } + if time > 100 { + break + } + } else { + break + } + } + fmt.Println("loaded:", loaded) + return totalView +} + +// @title ProjectView +// @description 获取指定用户和项目的访问量 +// @param User string "用户名" +// @param Project string "项目名" +// @param Gte string "起始时间" 如time.Now().AddDate(0, 0, -1).Format(time.RFC3339) +// @param Lte string "结束时间" +// @return totalView int "访问量" +func AppointProjectView(User string, Project string, Gte string, Lte string) (totalView int) { + InitInfo := ProjectViewInit(User, Project, Gte, Lte) + return ViewInfo(InitInfo) +} + +//统计项目相关页面的访问量 +type ProjectInfo struct { + /* 统计所有项目中该页面的浏览情况,不需要区分项目。以aiforge项目为例 */ + //地址:https://git.openi.org.cn/OpenI/aiforge/datasets?type=0 + Project_dataset_type_0 int + //地址:https://git.openi.org.cn/OpenI/aiforge/datasets?type=1 + Project_dataset_type_1 int + //地址:https://git.openi.org.cn/OpenI/aiforge/issues + Project_issues int + //地址:https://git.openi.org.cn/OpenI/aiforge/labels + Project_labels int + //地址:https://git.openi.org.cn/OpenI/aiforge/milestones + Project_milestones int + //地址:https://git.openi.org.cn/OpenI/aiforge/pulls + Project_pulls int + //地址:https://git.openi.org.cn/OpenI/aiforge/release + Project_release int + //地址:https://git.openi.org.cn/OpenI/aiforge/wiki + Project_wiki int + //地址:https://git.openi.org.cn/OpenI/aiforge/activity + Project_activity int + //地址:https://git.openi.org.cn/OpenI/aiforge/cloudbrain + Project_cloudbrain int + //地址:https://git.openi.org.cn/OpenI/aiforge/modelarts + Project_modelarts int + //地址:https://git.openi.org.cn/OpenI/aiforge/blockchain + Project_blockchain int + //地址:https://git.openi.org.cn/OpenI/aiforge/watchers + Project_watchers int + //地址:https://git.openi.org.cn/OpenI/aiforge/stars + Project_stars int + //地址:https://git.openi.org.cn/OpenI/aiforge/forks + Project_forks int +} + +// @title AllProjectView +// @description 获取指定用户和项目的访问量 +// @param Gte string "起始时间" 如time.Now().AddDate(0, 0, -1).Format(time.RFC3339) +// @param Lte string "结束时间" +// @return projectInfo ProjectInfo "统计所有项目中页面的浏览情况,不需要区分项目" +func AllProjectView(Gte string, Lte string) (projectInfo ProjectInfo) { + projectInfo.Project_dataset_type_0 = ViewInfo(AllProjectViewInit("/datasets?type=0", "%{[request][2]}", Gte, Lte)) + projectInfo.Project_dataset_type_1 = ViewInfo(AllProjectViewInit("/datasets?type=1", "%{[request][2]}", Gte, Lte)) + projectInfo.Project_issues = ViewInfo(AllProjectViewInit("/issues HTTP/2.0", "%{[request][2]}", Gte, Lte)) + projectInfo.Project_labels = ViewInfo(TagNameInit("/labels HTTP/2.0", "labels", Gte, Lte)) + projectInfo.Project_milestones = ViewInfo(AllProjectViewInit("/milestones HTTP/2.0", "%{[request][2]}", Gte, Lte)) + projectInfo.Project_pulls = ViewInfo(AllProjectViewInit("/pulls HTTP/2.0", "%{[request][2]}", Gte, Lte)) + projectInfo.Project_release = ViewInfo(AllProjectViewInit("/release HTTP/2.0", "%{[request][2]}", Gte, Lte)) + projectInfo.Project_wiki = ViewInfo(AllProjectViewInit("/wiki HTTP/2.0", "%{[request][2]}", Gte, Lte)) + projectInfo.Project_activity = ViewInfo(AllProjectViewInit("/activity HTTP/2.0", "%{[request][2]}", Gte, Lte)) + projectInfo.Project_cloudbrain = ViewInfo(AllProjectViewInit("/cloudbrain HTTP/2.0", "%{[request][2]}", Gte, Lte)) + projectInfo.Project_modelarts = ViewInfo(AllProjectViewInit("/modelarts HTTP/2.0", "%{[request][2]}", Gte, Lte)) + projectInfo.Project_blockchain = ViewInfo(AllProjectViewInit("/blockchain HTTP/2.0", "%{[request][2]}", Gte, Lte)) + projectInfo.Project_watchers = ViewInfo(AllProjectViewInit("/watchers HTTP/2.0", "%{[request][2]}", Gte, Lte)) + projectInfo.Project_stars = ViewInfo(AllProjectViewInit("/stars HTTP/2.0", "%{[request][2]}", Gte, Lte)) + projectInfo.Project_forks = ViewInfo(AllProjectViewInit("/forks HTTP/2.0", "%{[request][2]}", Gte, Lte)) + return projectInfo +} From 4000e3b790bade9018ba36d7db0efe6b61bae301 Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Wed, 13 Oct 2021 16:51:10 +0800 Subject: [PATCH 13/22] fix issue #515 --- templates/repo/issue/view.tmpl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/repo/issue/view.tmpl b/templates/repo/issue/view.tmpl index af4137238..0a44968f5 100644 --- a/templates/repo/issue/view.tmpl +++ b/templates/repo/issue/view.tmpl @@ -4,11 +4,13 @@
+ {{if .PageIsIssueList}} + {{end}}
{{if not .Repository.IsArchived}}
From 8ef3f99d36930a149792af5b88cd5eac74fe80bc Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Wed, 13 Oct 2021 16:54:49 +0800 Subject: [PATCH 14/22] fix issue #515 --- options/locale/locale_en-US.ini | 1 + options/locale/locale_zh-CN.ini | 1 + templates/repo/issue/view.tmpl | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index bf7be287d..7ab4401cc 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -847,6 +847,7 @@ filter_branch_and_tag = Filter branch or tag branches = Branches tags = Tags issues = Issues +issues_detail = Detail pulls = Pull Requests labels = Labels org_labels_desc = Organization level labels that can be used with all repositories under this organization diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index 04b3c2e59..09cade47c 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -849,6 +849,7 @@ filter_branch_and_tag=过滤分支或标签 branches=分支列表 tags=标签列表 issues=任务 +issues_detail=详情 pulls=合并请求 labels=标签 org_labels_desc=组织级别的标签,可以被本组织下的 所有项目 使用 diff --git a/templates/repo/issue/view.tmpl b/templates/repo/issue/view.tmpl index 0a44968f5..adc7376cf 100644 --- a/templates/repo/issue/view.tmpl +++ b/templates/repo/issue/view.tmpl @@ -8,7 +8,7 @@ {{end}}
From 88261fb0093c97e27d4184f90b5a1597d219d4eb Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Wed, 13 Oct 2021 17:47:40 +0800 Subject: [PATCH 15/22] fix issue #455 #453 #428 --- templates/explore/repo_left.tmpl | 22 ++++++++-------- templates/explore/repo_list.tmpl | 28 ++++++++++---------- templates/explore/repo_search.tmpl | 2 +- templates/repo/cloudbrain/index.tmpl | 2 +- templates/repo/modelarts/index.tmpl | 50 ++++++++++++++++++++++++++++-------- web_src/less/openi.less | 2 +- 6 files changed, 68 insertions(+), 38 deletions(-) diff --git a/templates/explore/repo_left.tmpl b/templates/explore/repo_left.tmpl index af32851c0..ca6a3b3dd 100755 --- a/templates/explore/repo_left.tmpl +++ b/templates/explore/repo_left.tmpl @@ -6,67 +6,67 @@ 全部领域 - + 大模型 - + AI开发工具 - + 计算机视觉 - + 自然语言处理 - + 机器学习 - + 神经网络 - + 自动驾驶 - + 机器人 - + 联邦学习 - + 数据挖掘 - + diff --git a/templates/explore/repo_list.tmpl b/templates/explore/repo_list.tmpl index a9eaaaccf..b05b0e469 100755 --- a/templates/explore/repo_list.tmpl +++ b/templates/explore/repo_list.tmpl @@ -40,20 +40,20 @@
@@ -143,7 +143,7 @@ {{if .Topics }}
{{range .Topics}} - {{if ne . "" }}
{{.}}
{{end}} + {{if ne . "" }}
{{.}}
{{end}} {{end}}
{{end}} diff --git a/templates/explore/repo_search.tmpl b/templates/explore/repo_search.tmpl index 7ed853fc8..d30ad5625 100644 --- a/templates/explore/repo_search.tmpl +++ b/templates/explore/repo_search.tmpl @@ -9,7 +9,7 @@
- +
diff --git a/templates/repo/cloudbrain/index.tmpl b/templates/repo/cloudbrain/index.tmpl index 495daa411..b1afa7027 100755 --- a/templates/repo/cloudbrain/index.tmpl +++ b/templates/repo/cloudbrain/index.tmpl @@ -318,7 +318,7 @@
- +
diff --git a/templates/repo/modelarts/index.tmpl b/templates/repo/modelarts/index.tmpl index a81e47827..fb499bdca 100755 --- a/templates/repo/modelarts/index.tmpl +++ b/templates/repo/modelarts/index.tmpl @@ -228,41 +228,71 @@
-
+ +
-
+
-->
+ + +
+
+
+ {{$.i18n.Tr "repo.cloudbrain_task"}} +
+
+ {{$.i18n.Tr "repo.cloudbrain_status_createtime"}} +
+
+ {{$.i18n.Tr "repo.cloudbrain_creator"}} +
+
+ {{$.i18n.Tr "repo.cloudbrain_operate"}} +
+ +
+ +
+ + + {{range .Tasks}}
-
- - {{svg "octicon-tasklist" 16}} - {{.JobName}} +
- + + + {{.Status}} - {{TimeSinceUnix .Cloudbrain.CreatedUnix $.Lang}} + {{TimeSinceUnix .Cloudbrain.CreatedUnix $.Lang}} +
+ +
+
diff --git a/web_src/less/openi.less b/web_src/less/openi.less index 3230a725d..cf8ca6d27 100644 --- a/web_src/less/openi.less +++ b/web_src/less/openi.less @@ -232,7 +232,7 @@ footer .column{margin-bottom:0!important; padding-bottom:0!important;} .i-bg-used{background-position: -514px -52px;} .icon-bind{background-position: -550px -52px;} .icon-unbind{background-position: -568px -52px;} -.WAITING{display:inline-block;background-image:url('/img/loading.gif');background-repeat:no-repeat;width:16px;height:16px;background-size:16px 16px;margin-right:5px;} +.CREATING, .STOPPING, .DELETING, .STARTING, .WAITING{display:inline-block;background-image:url('/img/loading.gif');background-repeat:no-repeat;width:16px;height:16px;background-size:16px 16px;margin-right:5px;} .text_over{ overflow: hidden; text-overflow: ellipsis; From fae6e7523ffef75e2f1e4b71de205b685bbe530d Mon Sep 17 00:00:00 2001 From: Gitea Date: Wed, 13 Oct 2021 19:34:11 +0800 Subject: [PATCH 16/22] Add configuration information --- modules/repository/elk_pagedata.go | 27 +++++++++++++-------------- modules/setting/setting.go | 16 ++++++++++++++++ 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/modules/repository/elk_pagedata.go b/modules/repository/elk_pagedata.go index fa4b61beb..f74324664 100644 --- a/modules/repository/elk_pagedata.go +++ b/modules/repository/elk_pagedata.go @@ -6,6 +6,8 @@ import ( "fmt" "io/ioutil" "net/http" + + "code.gitea.io/gitea/modules/setting" ) //输入elk的json结构begin @@ -98,7 +100,7 @@ type ResultInfo struct { //发送post请求到elk func SendReqToElk(jsonStr []byte) (content string) { - url := "http://192.168.207.35:5601/internal/bsearch" + url := setting.ElkUrl req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr)) req.Header.Set("Content-Type", "application/json") req.Header.Set("kbn-version", "7.13.2") @@ -126,17 +128,16 @@ func GetResultFromElk(resultinfo ResultInfo, jobResult string) (loaded int, tota func ProjectViewInit(User string, Project string, Gte string, Lte string) (projectViewInit InputInfo) { var inputStruct InputInfo inputStruct.Batch = make([]Batch, 1) - inputStruct.Batch[0].Request.Params.Index = "filebeat-7.3.2*" + inputStruct.Batch[0].Request.Params.Index = setting.Index inputStruct.Batch[0].Request.Params.Body.Size = 0 inputStruct.Batch[0].Request.Params.Body.Fields = make([]Fields, 1) - inputStruct.Batch[0].Request.Params.Body.Fields[0].Field = "@timestamptest" - inputStruct.Batch[0].Request.Params.Body.Fields[0].Format = "date_time" + 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) //限定查询时间 var timeRange Range timeRange.Timestamptest.Gte = Gte timeRange.Timestamptest.Lte = Lte - timeRange.Timestamptest.Format = "strict_date_optional_time" inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.Filter[0].Range = &timeRange //限定用户 var userName FilterMatchPhrase @@ -153,11 +154,11 @@ func ProjectViewInit(User string, Project string, Gte string, Lte string) (proje func AllProjectViewInit(MessageInfo string, NotProject string, Gte string, Lte string) (allProjectViewInit InputInfo) { var inputStruct InputInfo inputStruct.Batch = make([]Batch, 1) - inputStruct.Batch[0].Request.Params.Index = "filebeat-7.3.2*" + inputStruct.Batch[0].Request.Params.Index = setting.Index inputStruct.Batch[0].Request.Params.Body.Size = 0 inputStruct.Batch[0].Request.Params.Body.Fields = make([]Fields, 1) - inputStruct.Batch[0].Request.Params.Body.Fields[0].Field = "@timestamptest" - inputStruct.Batch[0].Request.Params.Body.Fields[0].Format = "date_time" + 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, 2) //限定message var bool Bool @@ -169,7 +170,6 @@ func AllProjectViewInit(MessageInfo string, NotProject string, Gte string, Lte s var timeRange Range timeRange.Timestamptest.Gte = Gte timeRange.Timestamptest.Lte = Lte - timeRange.Timestamptest.Format = "strict_date_optional_time" inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.Filter[1].Range = &timeRange //限定非项目 // var boolIn BoolIn @@ -182,11 +182,11 @@ func AllProjectViewInit(MessageInfo string, NotProject string, Gte string, Lte s func TagNameInit(MessageInfo string, Tagname string, Gte string, Lte string) (projectViewInit InputInfo) { var inputStruct InputInfo inputStruct.Batch = make([]Batch, 1) - inputStruct.Batch[0].Request.Params.Index = "filebeat-7.3.2*" + inputStruct.Batch[0].Request.Params.Index = setting.Index inputStruct.Batch[0].Request.Params.Body.Size = 0 inputStruct.Batch[0].Request.Params.Body.Fields = make([]Fields, 1) - inputStruct.Batch[0].Request.Params.Body.Fields[0].Field = "@timestamptest" - inputStruct.Batch[0].Request.Params.Body.Fields[0].Format = "date_time" + 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) //限定message var bool Bool @@ -202,7 +202,6 @@ func TagNameInit(MessageInfo string, Tagname string, Gte string, Lte string) (pr var timeRange Range timeRange.Timestamptest.Gte = Gte timeRange.Timestamptest.Lte = Lte - timeRange.Timestamptest.Format = "strict_date_optional_time" inputStruct.Batch[0].Request.Params.Body.Query.BoolIn.Filter[2].Range = &timeRange return inputStruct } @@ -242,7 +241,7 @@ func ViewInfo(viewInfo InputInfo) (totalView int) { // @param User string "用户名" // @param Project string "项目名" // @param Gte string "起始时间" 如time.Now().AddDate(0, 0, -1).Format(time.RFC3339) -// @param Lte string "结束时间" +// @param Lte string "结束时间" 如time.Now().Format(time.RFC3339) // @return totalView int "访问量" func AppointProjectView(User string, Project string, Gte string, Lte string) (totalView int) { InitInfo := ProjectViewInit(User, Project, Gte, Lte) diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 0fbc9f909..1830deff4 100755 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -482,6 +482,14 @@ var ( PoolInfos string Flavor string FlavorInfos string + + //obs config + ElkUrl string + ElkUser string + ElkPassword string + Index string + TimeField string + ElkTimeFormat string ) // DateLang transforms standard language locale name to corresponding value in datetime plugin. @@ -1201,6 +1209,14 @@ func NewContext() { PoolInfos = sec.Key("POOL_INFOS").MustString("") Flavor = sec.Key("FLAVOR").MustString("") FlavorInfos = sec.Key("FLAVOR_INFOS").MustString("") + + sec = Cfg.Section("elk") + ElkUrl = sec.Key("ELKURL").MustString("http://192.168.207.35:5601/internal/bsearch") + ElkUser = sec.Key("ELKUSER").MustString("Qizhi") + ElkPassword = sec.Key("ELKPASSWORD").MustString("Pcl2020") + Index = sec.Key("INDEX").MustString("filebeat-7.3.2*") + TimeField = sec.Key("TIMEFIELD").MustString(" @timestamptest") + ElkTimeFormat = sec.Key("ELKTIMEFORMAT").MustString("date_time") } func loadInternalToken(sec *ini.Section) string { From f0cb5ddc972a127ede1ea59bbf30b6ef68f433d7 Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Thu, 14 Oct 2021 10:07:39 +0800 Subject: [PATCH 17/22] fix issue #487 --- web_src/js/components/EditTopics.vue | 59 +++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 25 deletions(-) diff --git a/web_src/js/components/EditTopics.vue b/web_src/js/components/EditTopics.vue index 5c452d76a..5aa5e6e7a 100644 --- a/web_src/js/components/EditTopics.vue +++ b/web_src/js/components/EditTopics.vue @@ -61,18 +61,23 @@ export default { if(!this.showInitTopic[item]){ - - this.arrayTopics.push(array.topic_name) + if(this.arrayTopics.includes(array.topic_name)){ + return + } + else{ + this.arrayTopics.push(array.topic_name) + + let topics = this.arrayTopics + let strTopics = topics.join(',') + let data = this.qs.stringify({ + _csrf:csrf, + topics:strTopics + }) + this.Post(data,topics) + this.$set(this.showInitTopic,item,true) + $('#repo-topics1').children('span').remove() + } - let topics = this.arrayTopics - let strTopics = topics.join(',') - let data = this.qs.stringify({ - _csrf:csrf, - topics:strTopics - }) - this.Post(data,topics) - this.$set(this.showInitTopic,item,true) - $('#repo-topics1').children('span').remove() @@ -93,7 +98,6 @@ export default { this.Post(data,topics) this.$set(this.showInitTopic,item,false) if(this.arrayTopics.length===0){ - console.log("set empty") $('#repo-topics1').append('暂无标签') }else{ $('#repo-topics1').children('span').remove() @@ -199,7 +203,6 @@ export default { postTopic(){ const patter = /^[\u4e00-\u9fa5a-zA-Z0-9][\u4e00-\u9fa5a-zA-Z0-9-]{0,34}$/ let regexp = patter.test(this.input) - console.log("regexp",regexp) if(!regexp){ this.$notify({ @@ -210,19 +213,25 @@ export default { return }else{ let topic = this.input - this.arrayTopics.push(topic) + if(this.arrayTopics.includes(topic)){ + return + } + else{ + this.arrayTopics.push(topic) + + let topics = this.arrayTopics + let strTopics = topics.join(',') + let data = this.qs.stringify({ + _csrf:csrf, + topics:strTopics + }) + this.Post(data,topics) + $('#repo-topics1').children('span').remove() + this.showInputValue = false + this.showAddTopic = true + this.showAddFlage = true + } - let topics = this.arrayTopics - let strTopics = topics.join(',') - let data = this.qs.stringify({ - _csrf:csrf, - topics:strTopics - }) - this.Post(data,topics) - $('#repo-topics1').children('span').remove() - this.showInputValue = false - this.showAddTopic = true - this.showAddFlage = true } From 1f3c45e527baca223b2abb48b278d3904ae5c91f Mon Sep 17 00:00:00 2001 From: Gitea Date: Thu, 14 Oct 2021 10:38:36 +0800 Subject: [PATCH 18/22] elk --- modules/setting/setting.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 1830deff4..e1e7b7902 100755 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -483,7 +483,7 @@ var ( Flavor string FlavorInfos string - //obs config + //elk config ElkUrl string ElkUser string ElkPassword string From 10d7e9f8e814783265c003319266dff37f35ee5d Mon Sep 17 00:00:00 2001 From: Gitea Date: Thu, 14 Oct 2021 10:49:35 +0800 Subject: [PATCH 19/22] base64 --- modules/repository/elk_pagedata.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/repository/elk_pagedata.go b/modules/repository/elk_pagedata.go index f74324664..bb027726d 100644 --- a/modules/repository/elk_pagedata.go +++ b/modules/repository/elk_pagedata.go @@ -2,6 +2,7 @@ package repository import ( "bytes" + "encoding/base64" "encoding/json" "fmt" "io/ioutil" @@ -100,11 +101,14 @@ type ResultInfo struct { //发送post请求到elk func SendReqToElk(jsonStr []byte) (content string) { + ElkBase64Init := setting.ElkUser + ":" + setting.ElkPassword + ElkBase64 := base64.StdEncoding.EncodeToString([]byte(ElkBase64Init)) + BasicElkBase64 := "Basic" + " " + ElkBase64 url := setting.ElkUrl req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr)) req.Header.Set("Content-Type", "application/json") req.Header.Set("kbn-version", "7.13.2") - req.Header.Set("Authorization", "Basic cWl6aGk6UGNsMjAyMA==") + req.Header.Set("Authorization", BasicElkBase64) client := &http.Client{} resp, err := client.Do(req) From 6d993a206dd57ea001da39bb5f70b7ad1cbaa103 Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Thu, 14 Oct 2021 11:14:19 +0800 Subject: [PATCH 20/22] fix the pull page as same issue page --- templates/repo/issue/view.tmpl | 6 ++++++ templates/repo/pulls/commits.tmpl | 16 +++++++++++++++- templates/repo/pulls/files.tmpl | 16 +++++++++++++++- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/templates/repo/issue/view.tmpl b/templates/repo/issue/view.tmpl index adc7376cf..b8a88cd95 100644 --- a/templates/repo/issue/view.tmpl +++ b/templates/repo/issue/view.tmpl @@ -10,6 +10,12 @@
/
{{.i18n.Tr "repo.issues_detail"}}
+ {{else}} + {{end}}
{{if not .Repository.IsArchived}} diff --git a/templates/repo/pulls/commits.tmpl b/templates/repo/pulls/commits.tmpl index 422295f55..1dba43b84 100644 --- a/templates/repo/pulls/commits.tmpl +++ b/templates/repo/pulls/commits.tmpl @@ -2,11 +2,25 @@
{{template "repo/header" .}}
-