Browse Source

fix-1923

tags/v1.22.4.1^2
liuzx 3 years ago
parent
commit
ac460c2e2c
2 changed files with 20 additions and 0 deletions
  1. +7
    -0
      models/cloudbrain.go
  2. +13
    -0
      routers/user/home.go

+ 7
- 0
models/cloudbrain.go View File

@@ -307,6 +307,7 @@ type CloudbrainsOptions struct {
IsLatestVersion string
JobTypeNot bool
NeedRepoInfo bool
RepoIDList []int64
}

type TaskPod struct {
@@ -1179,6 +1180,12 @@ func Cloudbrains(opts *CloudbrainsOptions) ([]*CloudbrainInfo, int64, error) {
)
}
}
if len(opts.RepoIDList) > 0 {
cond = cond.And(
builder.In("cloudbrain.repo_id", opts.RepoIDList),
)

}

var count int64
var err error


+ 13
- 0
routers/user/home.go View File

@@ -801,6 +801,18 @@ func Cloudbrains(ctx *context.Context) {
if ctx.Written() {
return
}
repos, _, err := models.SearchRepository(&models.SearchRepoOptions{
Actor: ctx.User,
OwnerID: ctxUser.ID,
})
if err != nil {
ctx.ServerError("SearchRepository", err)
return
}
var repoIDList []int64
for i, _ := range repos {
repoIDList = append(repoIDList, repos[i].ID)
}
ciTasks, count, err := models.Cloudbrains(&models.CloudbrainsOptions{
ListOptions: models.ListOptions{
Page: page,
@@ -815,6 +827,7 @@ func Cloudbrains(ctx *context.Context) {
JobTypes: jobTypes,
NeedRepoInfo: true,
IsLatestVersion: modelarts.IsLatestVersion,
RepoIDList: repoIDList,
})
if err != nil {
ctx.ServerError("Get job failed:", err)


Loading…
Cancel
Save