| @@ -29,7 +29,8 @@ func MustEnableModelArts(ctx *context.Context) { | |||
| return | |||
| } | |||
| } | |||
| func ModelArtsIndex(ctx *context.Context) { | |||
| func NotebookIndex(ctx *context.Context) { | |||
| MustEnableModelArts(ctx) | |||
| repo := ctx.Repo.Repository | |||
| page := ctx.QueryInt("page") | |||
| @@ -67,7 +68,7 @@ func ModelArtsIndex(ctx *context.Context) { | |||
| ctx.HTML(200, tplModelArtsIndex) | |||
| } | |||
| func ModelArtsNew(ctx *context.Context) { | |||
| func NotebookNew(ctx *context.Context) { | |||
| ctx.Data["PageIsCloudBrain"] = true | |||
| t := time.Now() | |||
| @@ -88,7 +89,7 @@ func ModelArtsNew(ctx *context.Context) { | |||
| ctx.HTML(200, tplModelArtsNew) | |||
| } | |||
| func ModelArtsCreate(ctx *context.Context, form auth.CreateModelArtsForm) { | |||
| func NotebookCreate(ctx *context.Context, form auth.CreateModelArtsForm) { | |||
| ctx.Data["PageIsCloudBrain"] = true | |||
| jobName := form.JobName | |||
| uuid := form.Attachment | |||
| @@ -104,7 +105,7 @@ func ModelArtsCreate(ctx *context.Context, form auth.CreateModelArtsForm) { | |||
| ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/modelarts") | |||
| } | |||
| func ModelArtsShow(ctx *context.Context) { | |||
| func NotebookShow(ctx *context.Context) { | |||
| ctx.Data["PageIsCloudBrain"] = true | |||
| var jobID = ctx.Params(":jobid") | |||
| @@ -145,7 +146,7 @@ func ModelArtsShow(ctx *context.Context) { | |||
| ctx.HTML(200, tplModelArtsShow) | |||
| } | |||
| func ModelArtsDebug(ctx *context.Context) { | |||
| func NotebookDebug(ctx *context.Context) { | |||
| var jobID = ctx.Params(":jobid") | |||
| _, err := models.GetCloudbrainByJobID(jobID) | |||
| if err != nil { | |||
| @@ -180,7 +181,7 @@ func ModelArtsDebug(ctx *context.Context) { | |||
| ctx.Redirect(debugUrl) | |||
| } | |||
| func ModelArtsStop(ctx *context.Context) { | |||
| func NotebookStop(ctx *context.Context) { | |||
| var jobID = ctx.Params(":jobid") | |||
| log.Info(jobID) | |||
| task, err := models.GetCloudbrainByJobID(jobID) | |||
| @@ -212,10 +213,10 @@ func ModelArtsStop(ctx *context.Context) { | |||
| return | |||
| } | |||
| ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/modelarts") | |||
| ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/modelarts/notebook") | |||
| } | |||
| func ModelArtsDel(ctx *context.Context) { | |||
| func NotebookDel(ctx *context.Context) { | |||
| var jobID = ctx.Params(":jobid") | |||
| task, err := models.GetCloudbrainByJobID(jobID) | |||
| if err != nil { | |||
| @@ -242,6 +243,6 @@ func ModelArtsDel(ctx *context.Context) { | |||
| return | |||
| } | |||
| ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/modelarts") | |||
| ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/modelarts/notebook") | |||
| } | |||
| @@ -917,15 +917,29 @@ func RegisterRoutes(m *macaron.Macaron) { | |||
| }, context.RepoRef()) | |||
| m.Group("/modelarts", func() { | |||
| m.Get("", reqRepoCloudBrainReader, repo.ModelArtsIndex) | |||
| m.Group("/:jobid", func() { | |||
| m.Get("", reqRepoCloudBrainReader, repo.ModelArtsShow) | |||
| m.Get("/debug", reqRepoCloudBrainReader, repo.ModelArtsDebug) | |||
| m.Post("/stop", reqRepoCloudBrainWriter, repo.ModelArtsStop) | |||
| m.Post("/del", reqRepoCloudBrainWriter, repo.ModelArtsDel) | |||
| m.Group("/notebook", func() { | |||
| m.Get("", reqRepoCloudBrainReader, repo.NotebookIndex) | |||
| m.Group("/:jobid", func() { | |||
| m.Get("", reqRepoCloudBrainReader, repo.NotebookShow) | |||
| m.Get("/debug", reqRepoCloudBrainReader, repo.NotebookDebug) | |||
| m.Post("/stop", reqRepoCloudBrainWriter, repo.NotebookStop) | |||
| m.Post("/del", reqRepoCloudBrainWriter, repo.NotebookDel) | |||
| }) | |||
| m.Get("/create", reqRepoCloudBrainWriter, repo.NotebookNew) | |||
| m.Post("/create", reqRepoCloudBrainWriter, bindIgnErr(auth.CreateModelArtsForm{}), repo.NotebookCreate) | |||
| }) | |||
| m.Group("/train-job", func() { | |||
| m.Get("", reqRepoCloudBrainReader, repo.NotebookIndex) | |||
| m.Group("/:jobid", func() { | |||
| m.Get("", reqRepoCloudBrainReader, repo.NotebookShow) | |||
| m.Get("/debug", reqRepoCloudBrainReader, repo.NotebookDebug) | |||
| m.Post("/stop", reqRepoCloudBrainWriter, repo.NotebookStop) | |||
| m.Post("/del", reqRepoCloudBrainWriter, repo.NotebookDel) | |||
| }) | |||
| m.Get("/create", reqRepoCloudBrainWriter, repo.NotebookNew) | |||
| m.Post("/create", reqRepoCloudBrainWriter, bindIgnErr(auth.CreateModelArtsForm{}), repo.NotebookCreate) | |||
| }) | |||
| m.Get("/create", reqRepoCloudBrainWriter, repo.ModelArtsNew) | |||
| m.Post("/create", reqRepoCloudBrainWriter, bindIgnErr(auth.CreateModelArtsForm{}), repo.ModelArtsCreate) | |||
| }, context.RepoRef()) | |||
| m.Group("/blockchain", func() { | |||
| @@ -217,7 +217,7 @@ | |||
| if(checked_radio=='0'){ | |||
| window.location.href = repolink+'/cloudbrain' | |||
| }else if(checked_radio=='1'){ | |||
| window.location.href = repolink+'/modelarts' | |||
| window.location.href = repolink+'/modelarts/notebook' | |||
| }else{ | |||
| return; | |||
| } | |||
| @@ -206,7 +206,7 @@ | |||
| <div class="column right aligned"> | |||
| {{if .Permission.CanWrite $.UnitTypeCloudBrain}} | |||
| <a class="ui green button" href="{{.RepoLink}}/modelarts/create">{{.i18n.Tr "repo.cloudbrain.new"}}</a> {{end}} | |||
| <a class="ui green button" href="{{.RepoLink}}/modelarts/notebook/create">{{.i18n.Tr "repo.cloudbrain.new"}}</a> {{end}} | |||
| </div> | |||
| </div> | |||
| @@ -417,7 +417,7 @@ | |||
| return | |||
| } | |||
| $.get(`/api/v1/repos/${repoPath}/modelarts/${jobID}`, (data) => { | |||
| $.get(`/api/v1/repos/${repoPath}/modelarts/notebook/${jobID}`, (data) => { | |||
| const jobID = data.JobID | |||
| const status = data.JobStatus | |||
| $('#' + jobID).text(status) | |||