Browse Source

管理员删除云脑任务时返回管理员界面

tags/v1.22.2.2^2
liuzx 3 years ago
parent
commit
fc11cb5b54
2 changed files with 27 additions and 5 deletions
  1. +14
    -2
      routers/repo/cloudbrain.go
  2. +13
    -3
      routers/repo/modelarts.go

+ 14
- 2
routers/repo/cloudbrain.go View File

@@ -587,7 +587,13 @@ func CloudBrainDel(ctx *context.Context) {
ctx.ServerError(err.Error(), err)
return
}
ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/debugjob?debugListType=all")

var isAdminPage = ctx.Query(":isadminpage")
if ctx.IsUserSiteAdmin() && isAdminPage == "true" {
ctx.Redirect(setting.AppSubURL + "/admin" + "/cloudbrains")
} else {
ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/debugjob?debugListType=all")
}
}

func deleteCloudbrainJob(ctx *context.Context) error {
@@ -1343,5 +1349,11 @@ func BenchmarkDel(ctx *context.Context) {
ctx.ServerError(err.Error(), err)
return
}
ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/cloudbrain/benchmark")

var isAdminPage = ctx.Query(":isadminpage")
if ctx.IsUserSiteAdmin() && isAdminPage == "true" {
ctx.Redirect(setting.AppSubURL + "/admin" + "/cloudbrains")
} else {
ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/cloudbrain/benchmark")
}
}

+ 13
- 3
routers/repo/modelarts.go View File

@@ -307,7 +307,7 @@ func NotebookDebug2(ctx *context.Context) {
ctx.RenderWithErr(err.Error(), tplModelArtsNotebookIndex, nil)
return
}
ctx.Redirect(result.Url)
}

@@ -438,7 +438,12 @@ func NotebookDel(ctx *context.Context) {
return
}

ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/debugjob?debugListType=all")
var isAdminPage = ctx.Query(":isadminpage")
if ctx.IsUserSiteAdmin() && isAdminPage == "true" {
ctx.Redirect(setting.AppSubURL + "/admin" + "/cloudbrains")
} else {
ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/debugjob?debugListType=all")
}
}

func TrainJobIndex(ctx *context.Context) {
@@ -1543,7 +1548,12 @@ func TrainJobDel(ctx *context.Context) {
DeleteJobStorage(VersionListTasks[0].JobName)
}

ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/modelarts/train-job")
var isAdminPage = ctx.Query(":isadminpage")
if ctx.IsUserSiteAdmin() && isAdminPage == "true" {
ctx.Redirect(setting.AppSubURL + "/admin" + "/cloudbrains")
} else {
ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/modelarts/train-job")
}
}

func TrainJobStop(ctx *context.Context) {


Loading…
Cancel
Save