diff --git a/models/cloudbrain.go b/models/cloudbrain.go index e64fc8383..5bf066413 100755 --- a/models/cloudbrain.go +++ b/models/cloudbrain.go @@ -210,6 +210,7 @@ type CloudbrainsOptions struct { JobType string VersionName string IsLatestVersion string + JobTypeNot bool } type TaskPod struct { @@ -894,9 +895,15 @@ func Cloudbrains(opts *CloudbrainsOptions) ([]*CloudbrainInfo, int64, error) { } if (opts.JobType) != "" { - cond = cond.And( - builder.Eq{"cloudbrain.job_type": opts.JobType}, - ) + if opts.JobTypeNot { + cond = cond.And( + builder.Neq{"cloudbrain.job_type": opts.JobType}, + ) + } else { + cond = cond.And( + builder.Eq{"cloudbrain.job_type": opts.JobType}, + ) + } } if (opts.IsLatestVersion) != "" { diff --git a/models/repo_watch.go b/models/repo_watch.go index 1d6b7a31c..1ebc0ebec 100644 --- a/models/repo_watch.go +++ b/models/repo_watch.go @@ -286,7 +286,9 @@ func NotifyWatchers(actions ...*Action) error { func producer(actions ...*Action) { for _, action := range actions { - ActionChan <- action + if !action.IsPrivate{ + ActionChan <- action + } } } diff --git a/routers/repo/blame.go b/routers/repo/blame.go index 00ef9a99e..6ab357c09 100644 --- a/routers/repo/blame.go +++ b/routers/repo/blame.go @@ -6,13 +6,6 @@ package repo import ( "bytes" - "container/list" - "fmt" - "html" - gotemplate "html/template" - "net/url" - "strings" - "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/base" "code.gitea.io/gitea/modules/context" @@ -22,6 +15,12 @@ import ( "code.gitea.io/gitea/modules/markup" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/timeutil" + "container/list" + "fmt" + "html" + gotemplate "html/template" + "net/url" + "strings" ) const ( @@ -35,7 +34,52 @@ func RefBlame(ctx *context.Context) { ctx.NotFound("Blame FileName", nil) return } - + //get repo contributors info + contributors, err := git.GetContributors(ctx.Repo.Repository.RepoPath(), ctx.Repo.BranchName) + if err == nil && contributors != nil { + var contributorInfos []*ContributorInfo + contributorInfoHash := make(map[string]*ContributorInfo) + count := 0 + for _, c := range contributors { + if count >= 25 { + continue + } + if strings.Compare(c.Email, "") == 0 { + continue + } + // get user info from committer email + user, err := models.GetUserByActivateEmail(c.Email) + if err == nil { + // committer is system user, get info through user's primary email + if existedContributorInfo, ok := contributorInfoHash[user.Email]; ok { + // existed: same primary email, different committer name + existedContributorInfo.CommitCnt += c.CommitCnt + } else { + // new committer info + var newContributor = &ContributorInfo{ + user, user.RelAvatarLink(), user.Name, user.Email, c.CommitCnt, + } + count++ + contributorInfos = append(contributorInfos, newContributor) + contributorInfoHash[user.Email] = newContributor + } + } else { + // committer is not system user + if existedContributorInfo, ok := contributorInfoHash[c.Email]; ok { + // existed: same primary email, different committer name + existedContributorInfo.CommitCnt += c.CommitCnt + } else { + var newContributor = &ContributorInfo{ + user, "", "", c.Email, c.CommitCnt, + } + count++ + contributorInfos = append(contributorInfos, newContributor) + contributorInfoHash[c.Email] = newContributor + } + } + } + ctx.Data["ContributorInfo"] = contributorInfos + } userName := ctx.Repo.Owner.Name repoName := ctx.Repo.Repository.Name commitID := ctx.Repo.CommitID diff --git a/routers/repo/modelarts.go b/routers/repo/modelarts.go index 31b0b196b..a907aca01 100755 --- a/routers/repo/modelarts.go +++ b/routers/repo/modelarts.go @@ -49,12 +49,9 @@ func DebugJobIndex(ctx *context.Context) { page = 1 } debugType := modelarts.DebugType - jobType := string(models.JobTypeDebug) if debugListType == models.GPUResource { debugType = models.TypeCloudBrainOne - jobType = "" - } - if debugListType == models.NPUResource { + } else if debugListType == models.NPUResource { debugType = models.TypeCloudBrainTwo } @@ -63,9 +60,10 @@ func DebugJobIndex(ctx *context.Context) { Page: page, PageSize: setting.UI.IssuePagingNum, }, - RepoID: repo.ID, - Type: debugType, - JobType: jobType, + RepoID: repo.ID, + Type: debugType, + JobTypeNot: true, + JobType: string(models.JobTypeTrain), }) if err != nil { ctx.ServerError("Get debugjob faild:", err) @@ -371,6 +369,7 @@ func TrainJobIndex(ctx *context.Context) { }, RepoID: repo.ID, Type: models.TypeCloudBrainTwo, + JobTypeNot: false, JobType: string(models.JobTypeTrain), IsLatestVersion: modelarts.IsLatestVersion, }) diff --git a/routers/routes/routes.go b/routers/routes/routes.go index 95931c723..481b0eacb 100755 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -969,13 +969,13 @@ func RegisterRoutes(m *macaron.Macaron) { m.Group("/:jobid", func() { m.Get("", reqRepoCloudBrainReader, repo.CloudBrainShow) m.Get("/debug", cloudbrain.AdminOrJobCreaterRight, repo.CloudBrainDebug) - m.Post("/commit_image", cloudbrain.AdminOrOwnerOrJobCreaterRight, bindIgnErr(auth.CommitImageCloudBrainForm{}), repo.CloudBrainCommitImage) + m.Post("/commit_image", cloudbrain.AdminOrJobCreaterRight, bindIgnErr(auth.CommitImageCloudBrainForm{}), repo.CloudBrainCommitImage) m.Post("/stop", cloudbrain.AdminOrOwnerOrJobCreaterRight, repo.CloudBrainStop) m.Post("/del", cloudbrain.AdminOrOwnerOrJobCreaterRight, repo.CloudBrainDel) - m.Post("/restart", reqRepoCloudBrainWriter, repo.CloudBrainRestart) + m.Post("/restart", cloudbrain.AdminOrJobCreaterRight, repo.CloudBrainRestart) m.Get("/rate", reqRepoCloudBrainReader, repo.GetRate) m.Get("/models", reqRepoCloudBrainReader, repo.CloudBrainShowModels) - m.Get("/download_model", cloudbrain.AdminOrOwnerOrJobCreaterRight, repo.CloudBrainDownloadModel) + m.Get("/download_model", cloudbrain.AdminOrJobCreaterRight, repo.CloudBrainDownloadModel) }) m.Get("/create", reqRepoCloudBrainWriter, repo.CloudBrainNew) m.Post("/create", reqRepoCloudBrainWriter, bindIgnErr(auth.CreateCloudBrainForm{}), repo.CloudBrainCreate) @@ -1021,7 +1021,7 @@ func RegisterRoutes(m *macaron.Macaron) { m.Get("", reqRepoCloudBrainReader, repo.TrainJobShow) m.Post("/stop", cloudbrain.AdminOrOwnerOrJobCreaterRight, repo.TrainJobStop) m.Post("/del", cloudbrain.AdminOrOwnerOrJobCreaterRight, repo.TrainJobDel) - m.Get("/model_download", cloudbrain.AdminOrOwnerOrJobCreaterRight, repo.ModelDownload) + m.Get("/model_download", cloudbrain.AdminOrJobCreaterRight, repo.ModelDownload) m.Get("/create_version", cloudbrain.AdminOrJobCreaterRight, repo.TrainJobNewVersion) m.Post("/create_version", cloudbrain.AdminOrJobCreaterRight, bindIgnErr(auth.CreateModelArtsTrainJobForm{}), repo.TrainJobCreateVersion) }) diff --git a/templates/org/select_pro.tmpl b/templates/org/select_pro.tmpl index 56af489fd..647bccd57 100755 --- a/templates/org/select_pro.tmpl +++ b/templates/org/select_pro.tmpl @@ -13,7 +13,8 @@ .header_card{ /* color:#003A8C !important; */ color:#0366D6 !important; - margin: 10px 0; + margin: 10px 0 0px 0; + height: 25px; } .marg{ margin: 0 5px !important; @@ -28,6 +29,7 @@ } .descript_height{ color: #101010 !important; + margin: 10px 0; height: 40px !important; word-break:break-all; line-height: 20px; @@ -44,9 +46,23 @@ .full_height{ height: 100%; } + .omit{ + overflow: hidden; white-space: nowrap; text-overflow: ellipsis; + } /deep/ ui.checkbox input[type=checkbox]::after{ border: 1px solid #0366D6 !important; } + .nowrap-2 { + /* height: 2.837em; */ + /* line-height: 1.4285em; */ + overflow: hidden; + overflow: hidden; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + } + +