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/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index bf7be287d..746e46463 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. @@ -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) @@ -847,6 +850,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 @@ -1243,6 +1247,11 @@ 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.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 04b3c2e59..6dc0d410c 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数据(默认分支) @@ -849,6 +852,7 @@ filter_branch_and_tag=过滤分支或标签 branches=分支列表 tags=标签列表 issues=任务 +issues_detail=详情 pulls=合并请求 labels=标签 org_labels_desc=组织级别的标签,可以被本组织下的 所有项目 使用 @@ -1245,6 +1249,11 @@ 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.upstream_error=获取上游分支信息错误 pulls.no_merge_desc=由于未启用合并选项,此合并请求无法被合并。 pulls.no_merge_helper=在项目设置中启用合并选项或者手工合并请求。 diff --git a/routers/home.go b/routers/home.go index a1c07e317..70fea437c 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 { @@ -177,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 diff --git a/routers/repo/view.go b/routers/repo/view.go index 1546f53b7..0d284c42b 100644 --- a/routers/repo/view.go +++ b/routers/repo/view.go @@ -790,6 +790,44 @@ 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()) + defer baseGitRepo.Close() + if err != nil { + log.Error("error open baseRepo:%s",ctx.Repo.Repository.BaseRepo.RepoPath()) + ctx.Data["FetchUpstreamCnt"] = -1 // minus value indicates error + }else{ + 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{ + ctx.Data["FetchUpstreamCnt"] = -1 // minus value indicates error + } + } + } ctx.Data["Paths"] = paths ctx.Data["TreeLink"] = treeLink ctx.Data["TreeNames"] = treeNames 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 4021fde97..b1afa7027 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}} - +
+
-
-
+
+ {{end}} {{else}} 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}} diff --git a/templates/repo/issue/view.tmpl b/templates/repo/issue/view.tmpl index af4137238..adc7376cf 100644 --- a/templates/repo/issue/view.tmpl +++ b/templates/repo/issue/view.tmpl @@ -4,11 +4,13 @@
+ {{if .PageIsIssueList}} + {{end}}
{{if not .Repository.IsArchived}}
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/js/components/EditTopics.vue b/web_src/js/components/EditTopics.vue index c946dff47..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() @@ -197,32 +201,37 @@ 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' }); 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 } 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;