Chromium Code Reviews| Index: appengine/cmd/cron/ui/invocation.go |
| diff --git a/appengine/cmd/cron/ui/invocation.go b/appengine/cmd/cron/ui/invocation.go |
| index ff9fe101df40ec2018f08d05325014f74bc406e5..076f1336b441b9b61e4c64a561c6a380485f3233 100644 |
| --- a/appengine/cmd/cron/ui/invocation.go |
| +++ b/appengine/cmd/cron/ui/invocation.go |
| @@ -14,29 +14,32 @@ import ( |
| "github.com/luci/luci-go/common/clock" |
| "github.com/luci/luci-go/server/auth" |
| + "github.com/luci/luci-go/server/router" |
| "github.com/luci/luci-go/server/templates" |
| ) |
| -func invocationPage(c context.Context, w http.ResponseWriter, r *http.Request, p httprouter.Params) { |
| - projectID := p.ByName("ProjectID") |
| - jobID := p.ByName("JobID") |
| - invID, err := strconv.ParseInt(p.ByName("InvID"), 10, 64) |
| +func invocationPage(c *router.Context) { |
| + projectID := c.Params.ByName("ProjectID") |
| + jobID := c.Params.ByName("JobID") |
| + invID, err := strconv.ParseInt(c.Params.ByName("InvID"), 10, 64) |
| if err != nil { |
| - http.Error(w, "No such invocation", http.StatusNotFound) |
| + http.Error(c.Writer, "No such invocation", http.StatusNotFound) |
| + c.Abort() |
|
iannucci
2016/06/13 19:23:28
probably-unpopular-idea: instead of adding a new m
|
| return |
| } |
| - inv, err := config(c).Engine.GetInvocation(c, projectID+"/"+jobID, invID) |
| + inv, err := config(c.Context).Engine.GetInvocation(c.Context, projectID+"/"+jobID, invID) |
| if err != nil { |
| panic(err) |
| } |
| if inv == nil { |
| - http.Error(w, "No such invocation", http.StatusNotFound) |
| + http.Error(c.Writer, "No such invocation", http.StatusNotFound) |
| + c.Abort() |
| return |
| } |
| - now := clock.Now(c).UTC() |
| - templates.MustRender(c, w, "pages/invocation.html", map[string]interface{}{ |
| + now := clock.Now(c.Context).UTC() |
| + templates.MustRender(c.Context, c.Writer, "pages/invocation.html", map[string]interface{}{ |
| "ProjectID": projectID, |
| "JobID": jobID, |
| "Inv": makeInvocation(projectID, jobID, inv, now), |
| @@ -46,10 +49,10 @@ func invocationPage(c context.Context, w http.ResponseWriter, r *http.Request, p |
| //////////////////////////////////////////////////////////////////////////////// |
| // Actions. |
| -func abortInvocationAction(c context.Context, w http.ResponseWriter, r *http.Request, p httprouter.Params) { |
| - handleInvAction(c, w, r, p, func(jobID string, invID int64) error { |
| - who := auth.CurrentIdentity(c) |
| - return config(c).Engine.AbortInvocation(c, jobID, invID, who) |
| +func abortInvocationAction(c *router.Context) { |
| + handleInvAction(c.Context, c.Writer, c.Request, c.Params, func(jobID string, invID int64) error { |
| + who := auth.CurrentIdentity(c.Context) |
| + return config(c.Context).Engine.AbortInvocation(c.Context, jobID, invID, who) |
| }) |
| } |