Browse Source

opt query times

tags/v1.22.1.1^2
lewis 4 years ago
parent
commit
e65f269459
3 changed files with 4 additions and 14 deletions
  1. +2
    -1
      modules/cloudbrain/cloudbrain.go
  2. +1
    -0
      modules/context/context.go
  3. +1
    -13
      routers/repo/cloudbrain.go

+ 2
- 1
modules/cloudbrain/cloudbrain.go View File

@@ -82,7 +82,7 @@ func AdminOrOwnerOrJobCreaterRight(ctx *context.Context) {
var jobID = ctx.Params(":jobid")

job, err := models.GetCloudbrainByJobID(jobID)
ctx.Cloudbrain = job
if !isAdminOrOwnerOrJobCreater(ctx, job, err) {

ctx.NotFound(ctx.Req.URL.RequestURI(), nil)
@@ -94,6 +94,7 @@ func AdminOrJobCreaterRight(ctx *context.Context) {

var jobID = ctx.Params(":jobid")
job, err := models.GetCloudbrainByJobID(jobID)
ctx.Cloudbrain = job
if !isAdminOrJobCreater(ctx, job, err) {

ctx.NotFound(ctx.Req.URL.RequestURI(), nil)


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

@@ -46,6 +46,7 @@ type Context struct {

Repo *Repository
Org *Organization
Cloudbrain *models.Cloudbrain
}

// IsUserSiteAdmin returns true if current user is a site admin


+ 1
- 13
routers/repo/cloudbrain.go View File

@@ -369,19 +369,7 @@ func CloudBrainShow(ctx *context.Context) {
}

func CloudBrainDebug(ctx *context.Context) {
var jobID = ctx.Params(":jobid")
if !ctx.IsSigned {
log.Error("the user has not signed in")
ctx.Error(http.StatusForbidden, "", "the user has not signed in")
return
}
task, err := models.GetCloudbrainByJobID(jobID)
if err != nil {
ctx.ServerError("GetCloudbrainByJobID failed", err)
return
}

debugUrl := setting.DebugServerHost + "jpylab_" + task.JobID + "_" + task.SubTaskName
debugUrl := setting.DebugServerHost + "jpylab_" + ctx.Cloudbrain.JobID + "_" + ctx.Cloudbrain.SubTaskName
ctx.Redirect(debugUrl)
}



Loading…
Cancel
Save