Browse Source

Merge branch 'fix-1477' of https://git.openi.org.cn/OpenI/aiforge into fix-1477

tags/v1.22.2.2^2
zhoupzh 3 years ago
parent
commit
fc2152bbe2
5 changed files with 26 additions and 7 deletions
  1. +15
    -0
      modules/context/context.go
  2. +4
    -0
      routers/repo/modelarts.go
  3. +5
    -5
      routers/routes/routes.go
  4. +1
    -1
      web_src/js/components/MinioUploader.vue
  5. +1
    -1
      web_src/js/components/ObsUploader.vue

+ 15
- 0
modules/context/context.go View File

@@ -354,3 +354,18 @@ func Contexter() macaron.Handler {
c.Map(ctx)
}
}

// CheckWechatBind
func (ctx *Context) CheckWechatBind() {
if !setting.WechatAuthSwitch || ctx.User.IsBindWechat() {
return
}
redirectUrl := ctx.Query("redirect_to")
if redirectUrl == "" {
redirectUrl = ctx.Req.URL.RequestURI()
}
ctx.SetCookie("redirect_to", setting.AppSubURL+redirectUrl, 0, setting.AppSubURL)
ctx.JSON(200, map[string]string{
"WechatRedirectUrl": setting.AppSubURL + "/authentication/wechat/bind",
})
}

+ 4
- 0
routers/repo/modelarts.go View File

@@ -344,6 +344,10 @@ func NotebookManage(ctx *context.Context) {
break
}
} else if action == models.ActionRestart {
ctx.CheckWechatBind()
if ctx.Written() {
return
}
if task.Status != string(models.ModelArtsStopped) && task.Status != string(models.ModelArtsStartFailed) && task.Status != string(models.ModelArtsCreateFailed) {
log.Error("the job(%s) is not stopped", task.JobName, ctx.Data["MsgID"])
resultCode = "-1"


+ 5
- 5
routers/routes/routes.go View File

@@ -993,7 +993,7 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Get("", reqRepoCloudBrainReader, repo.CloudBrainShow)
})
m.Group("/:jobid", func() {
m.Get("/debug", reqWechatBind,cloudbrain.AdminOrJobCreaterRight, repo.CloudBrainDebug)
m.Get("/debug", reqWechatBind, cloudbrain.AdminOrJobCreaterRight, repo.CloudBrainDebug)
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)
@@ -1064,8 +1064,8 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Post("/:action", reqRepoCloudBrainWriter, repo.NotebookManage)
m.Post("/del", cloudbrain.AdminOrOwnerOrJobCreaterRight, repo.NotebookDel)
})
m.Get("/create", reqRepoCloudBrainWriter, repo.NotebookNew)
m.Post("/create", reqRepoCloudBrainWriter, bindIgnErr(auth.CreateModelArtsNotebookForm{}), repo.Notebook2Create)
m.Get("/create", reqWechatBind, reqRepoCloudBrainWriter, repo.NotebookNew)
m.Post("/create", reqWechatBind, reqRepoCloudBrainWriter, bindIgnErr(auth.CreateModelArtsNotebookForm{}), repo.Notebook2Create)
})

m.Group("/train-job", func() {
@@ -1075,8 +1075,8 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Post("/stop", cloudbrain.AdminOrOwnerOrJobCreaterRight, repo.TrainJobStop)
m.Post("/del", cloudbrain.AdminOrOwnerOrJobCreaterRight, repo.TrainJobDel)
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)
m.Get("/create_version", reqWechatBind, cloudbrain.AdminOrJobCreaterRight, repo.TrainJobNewVersion)
m.Post("/create_version", reqWechatBind, cloudbrain.AdminOrJobCreaterRight, bindIgnErr(auth.CreateModelArtsTrainJobForm{}), repo.TrainJobCreateVersion)
})
m.Get("/create", reqWechatBind, reqRepoCloudBrainWriter, repo.TrainJobNew)
m.Post("/create", reqWechatBind, reqRepoCloudBrainWriter, bindIgnErr(auth.CreateModelArtsTrainJobForm{}), repo.TrainJobCreate)


+ 1
- 1
web_src/js/components/MinioUploader.vue View File

@@ -81,7 +81,7 @@ export default {
dictInvalidFileType: this.dropzoneParams.data('invalid-input-type'),
dictFileTooBig: this.dropzoneParams.data('file-too-big'),
dictRemoveFile: this.dropzoneParams.data('remove-file'),
// previewTemplate
previewTemplate
});
dropzoneUploader.on('addedfile', (file) => {
setTimeout(() => {


+ 1
- 1
web_src/js/components/ObsUploader.vue View File

@@ -82,7 +82,7 @@ export default {
dictInvalidFileType: this.dropzoneParams.data('invalid-input-type'),
dictFileTooBig: this.dropzoneParams.data('file-too-big'),
dictRemoveFile: this.dropzoneParams.data('remove-file'),
// previewTemplate
previewTemplate
});
dropzoneUploader.on('addedfile', (file) => {
setTimeout(() => {


Loading…
Cancel
Save