Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The LUCI Authors. All rights reserved. | 1 // Copyright 2017 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package frontend | 5 package frontend |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "github.com/luci/luci-go/milo/buildsource" | 8 "github.com/luci/luci-go/milo/buildsource" |
| 9 "github.com/luci/luci-go/server/router" | 9 "github.com/luci/luci-go/server/router" |
| 10 "github.com/luci/luci-go/server/templates" | 10 "github.com/luci/luci-go/server/templates" |
| 11 ) | 11 ) |
| 12 | 12 |
| 13 // BuilderHandler is responsible for taking a universal builder ID and rendering | 13 // BuilderHandler is responsible for taking a universal builder ID and rendering |
| 14 // the builder page (defined in ./appengine/templates/pages/builder.html). | 14 // the builder page (defined in ./appengine/templates/pages/builder.html). |
| 15 func BuilderHandler(c *router.Context, builderID buildsource.BuilderID) { | 15 func BuilderHandler(c *router.Context, builderID buildsource.BuilderID) { |
| 16 » builder, err := builderID.Get(c.Context, c.Params.ByName("limit"), c.Par ams.ByName("cursor")) | 16 » limit := 25 |
| 17 » if tLimit, err := GetLimit(c.Request); err == nil { | |
|
iannucci
2017/07/19 00:04:57
make this take a default and not return error
Ryan Tseng
2017/07/19 00:12:30
Done.
| |
| 18 » » limit = tLimit | |
| 19 » } | |
| 20 » builder, err := builderID.Get(c.Context, limit, c.Request.FormValue("cur sor")) | |
| 17 // TODO(iannucci, hinoka): make MiloBuild refer to annotation stream by | 21 // TODO(iannucci, hinoka): make MiloBuild refer to annotation stream by |
| 18 // host/prefix/path instead of by directly pulling it. Do all annotation | 22 // host/prefix/path instead of by directly pulling it. Do all annotation |
| 19 // stream rendering in the frontend. | 23 // stream rendering in the frontend. |
| 20 if err != nil { | 24 if err != nil { |
| 21 ErrorHandler(c, err) | 25 ErrorHandler(c, err) |
| 22 } else { | 26 } else { |
| 23 templates.MustRender(c.Context, c.Writer, "pages/builder.html", templates.Args{ | 27 templates.MustRender(c.Context, c.Writer, "pages/builder.html", templates.Args{ |
| 24 "Builder": builder, | 28 "Builder": builder, |
| 25 }) | 29 }) |
| 26 } | 30 } |
| 27 } | 31 } |
| OLD | NEW |