| OLD | NEW |
| 1 // Copyright 2015 The LUCI Authors. | 1 // Copyright 2015 The LUCI Authors. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 ) | 30 ) |
| 31 | 31 |
| 32 func jobPage(ctx *router.Context) { | 32 func jobPage(ctx *router.Context) { |
| 33 c, w, r, p := ctx.Context, ctx.Writer, ctx.Request, ctx.Params | 33 c, w, r, p := ctx.Context, ctx.Writer, ctx.Request, ctx.Params |
| 34 | 34 |
| 35 projectID := p.ByName("ProjectID") | 35 projectID := p.ByName("ProjectID") |
| 36 jobName := p.ByName("JobName") | 36 jobName := p.ByName("JobName") |
| 37 cursor := r.URL.Query().Get("c") | 37 cursor := r.URL.Query().Get("c") |
| 38 | 38 |
| 39 // Grab the job from the datastore. | 39 // Grab the job from the datastore. |
| 40 » job, err := config(c).Engine.GetJob(c, projectID+"/"+jobName) | 40 » job, err := config(c).Engine.GetJobRA(c, projectID+"/"+jobName) |
| 41 if err != nil { | 41 if err != nil { |
| 42 panic(err) | 42 panic(err) |
| 43 } | 43 } |
| 44 if job == nil { | 44 if job == nil { |
| 45 http.Error(w, "No such job", http.StatusNotFound) | 45 http.Error(w, "No such job", http.StatusNotFound) |
| 46 return | 46 return |
| 47 } | 47 } |
| 48 | 48 |
| 49 // Grab latest invocations from the datastore. | 49 // Grab latest invocations from the datastore. |
| 50 invs, nextCursor, err := config(c).Engine.ListInvocations(c, job.JobID,
50, cursor) | 50 invs, nextCursor, err := config(c).Engine.ListInvocations(c, job.JobID,
50, cursor) |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 jobName := c.Params.ByName("JobName") | 183 jobName := c.Params.ByName("JobName") |
| 184 if !acl.IsJobOwner(c.Context, projectID, jobName) { | 184 if !acl.IsJobOwner(c.Context, projectID, jobName) { |
| 185 http.Error(c.Writer, "Forbidden", 403) | 185 http.Error(c.Writer, "Forbidden", 403) |
| 186 return | 186 return |
| 187 } | 187 } |
| 188 if err := cb(projectID + "/" + jobName); err != nil { | 188 if err := cb(projectID + "/" + jobName); err != nil { |
| 189 panic(err) | 189 panic(err) |
| 190 } | 190 } |
| 191 http.Redirect(c.Writer, c.Request, fmt.Sprintf("/jobs/%s/%s", projectID,
jobName), http.StatusFound) | 191 http.Redirect(c.Writer, c.Request, fmt.Sprintf("/jobs/%s/%s", projectID,
jobName), http.StatusFound) |
| 192 } | 192 } |
| OLD | NEW |