From fc11cb5b54804d41c5c6243b4e0953ceee4b5712 Mon Sep 17 00:00:00 2001 From: liuzx Date: Fri, 18 Feb 2022 10:16:06 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E4=BA=91=E8=84=91=E4=BB=BB=E5=8A=A1=E6=97=B6=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routers/repo/cloudbrain.go | 16 ++++++++++++++-- routers/repo/modelarts.go | 16 +++++++++++++--- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index 0599fb03f..506e2852e 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -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") + } } diff --git a/routers/repo/modelarts.go b/routers/repo/modelarts.go index 7e9ae3c09..6e06f98fb 100755 --- a/routers/repo/modelarts.go +++ b/routers/repo/modelarts.go @@ -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) {