|
|
|
@@ -103,45 +103,6 @@ func MustEnableModelArts(ctx *context.Context) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func NotebookIndex(ctx *context.Context) { |
|
|
|
MustEnableModelArts(ctx) |
|
|
|
repo := ctx.Repo.Repository |
|
|
|
page := ctx.QueryInt("page") |
|
|
|
if page <= 0 { |
|
|
|
page = 1 |
|
|
|
} |
|
|
|
|
|
|
|
ciTasks, count, err := models.Cloudbrains(&models.CloudbrainsOptions{ |
|
|
|
ListOptions: models.ListOptions{ |
|
|
|
Page: page, |
|
|
|
PageSize: setting.UI.IssuePagingNum, |
|
|
|
}, |
|
|
|
RepoID: repo.ID, |
|
|
|
Type: models.TypeCloudBrainTwo, |
|
|
|
JobType: string(models.JobTypeDebug), |
|
|
|
}) |
|
|
|
if err != nil { |
|
|
|
ctx.ServerError("Cloudbrain", err) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
for i, task := range ciTasks { |
|
|
|
|
|
|
|
ciTasks[i].CanDebug = cloudbrain.CanCreateOrDebugJob(ctx) |
|
|
|
ciTasks[i].CanDel = cloudbrain.CanDeleteJob(ctx, &task.Cloudbrain) |
|
|
|
ciTasks[i].Cloudbrain.ComputeResource = modelarts.NPUResource |
|
|
|
} |
|
|
|
|
|
|
|
pager := context.NewPagination(int(count), setting.UI.IssuePagingNum, page, 5) |
|
|
|
pager.SetDefaultParams(ctx) |
|
|
|
ctx.Data["Page"] = pager |
|
|
|
|
|
|
|
ctx.Data["PageIsCloudBrain"] = true |
|
|
|
ctx.Data["Tasks"] = ciTasks |
|
|
|
ctx.Data["CanCreate"] = cloudbrain.CanCreateOrDebugJob(ctx) |
|
|
|
ctx.HTML(200, tplModelArtsNotebookIndex) |
|
|
|
} |
|
|
|
|
|
|
|
func NotebookNew(ctx *context.Context) { |
|
|
|
ctx.Data["PageIsCloudBrain"] = true |
|
|
|
|
|
|
|
|