Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(597)

Side by Side Diff: milo/appengine/buildbot/html.go

Issue 2810113002: Milo buildbot builder page: Add pagnation with cursors. (Closed)
Patch Set: Touchups Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The LUCI Authors. All rights reserved. 1 // Copyright 2015 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 buildbot 5 package buildbot
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 "net/http" 9 "net/http"
10 "strconv" 10 "strconv"
11 11
12 "github.com/luci/gae/service/datastore"
12 "github.com/luci/luci-go/milo/appengine/common" 13 "github.com/luci/luci-go/milo/appengine/common"
13 "github.com/luci/luci-go/server/router" 14 "github.com/luci/luci-go/server/router"
14 "github.com/luci/luci-go/server/templates" 15 "github.com/luci/luci-go/server/templates"
15 ) 16 )
16 17
17 // BuildHandler Renders the buildbot build page. 18 // BuildHandler Renders the buildbot build page.
18 func BuildHandler(c *router.Context) { 19 func BuildHandler(c *router.Context) {
19 master := c.Params.ByName("master") 20 master := c.Params.ByName("master")
20 if master == "" { 21 if master == "" {
21 common.ErrorPage(c, http.StatusBadRequest, "No master specified" ) 22 common.ErrorPage(c, http.StatusBadRequest, "No master specified" )
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 return 74 return
74 } 75 }
75 limit, err := common.GetLimit(c.Request) 76 limit, err := common.GetLimit(c.Request)
76 if err != nil { 77 if err != nil {
77 common.ErrorPage(c, http.StatusBadRequest, err.Error()) 78 common.ErrorPage(c, http.StatusBadRequest, err.Error())
78 return 79 return
79 } 80 }
80 if limit < 0 { 81 if limit < 0 {
81 limit = 25 82 limit = 25
82 } 83 }
84 sCursor := c.Request.FormValue("cursor")
83 85
84 » result, err := builderImpl(c.Context, master, builder, limit) 86 » var thisCursor *datastore.Cursor
87 » if sCursor != "" {
88 » » tmpCur, err := datastore.DecodeCursor(c.Context, sCursor)
89 » » if err != nil {
90 » » » common.ErrorPage(c, http.StatusBadRequest, fmt.Sprintf(" bad cursor: %s", err.Error()))
91 » » » return
92 » » }
93 » » thisCursor = &tmpCur
94 » }
95
96 » result, err := builderImpl(c.Context, master, builder, limit, thisCursor )
85 if err != nil { 97 if err != nil {
86 common.ErrorPage(c, http.StatusInternalServerError, err.Error()) 98 common.ErrorPage(c, http.StatusInternalServerError, err.Error())
87 return 99 return
88 } 100 }
89 101
90 // Render into the template 102 // Render into the template
91 templates.MustRender(c.Context, c.Writer, "pages/builder.html", template s.Args{ 103 templates.MustRender(c.Context, c.Writer, "pages/builder.html", template s.Args{
92 "Builder": result, 104 "Builder": result,
93 }) 105 })
94 } 106 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698