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

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

Issue 2494243002: Milo: Fix more builds link in builders page (Closed)
Patch Set: Added notes to builder html handlers Created 4 years, 1 month 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 2016 The LUCI Authors. All rights reserved. 1 // Copyright 2016 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 buildbucket 5 package buildbucket
6 6
7 import ( 7 import (
8 "net/http" 8 "net/http"
9 9
10 "github.com/julienschmidt/httprouter" 10 "github.com/julienschmidt/httprouter"
11 "golang.org/x/net/context" 11 "golang.org/x/net/context"
12 12
13 "github.com/luci/luci-go/milo/appengine/settings" 13 "github.com/luci/luci-go/milo/appengine/settings"
14 "github.com/luci/luci-go/milo/common/miloerror" 14 "github.com/luci/luci-go/milo/common/miloerror"
15 "github.com/luci/luci-go/server/templates" 15 "github.com/luci/luci-go/server/templates"
16 ) 16 )
17 17
18 // TODO(nodir): move this value to luci-config. 18 // TODO(nodir): move this value to luci-config.
19 const defaultServer = "cr-buildbucket.appspot.com" 19 const defaultServer = "cr-buildbucket.appspot.com"
20 20
21 // Builder displays builder view by fetching builds from buildbucket. 21 // Builder displays builder view by fetching builds from buildbucket.
22 type Builder struct{} 22 type Builder struct{}
23 23
24 // GetTemplateName for Builder returns the template name for builder pages. 24 // GetTemplateName for Builder returns the template name for builder pages.
25 func (b Builder) GetTemplateName(t settings.Theme) string { 25 func (b Builder) GetTemplateName(t settings.Theme) string {
26 return "builder.html" 26 return "builder.html"
27 } 27 }
28 28
29 // Render renders builder view page. 29 // Render renders builder view page.
30 // Note: The builder html template contains self links to "?limit=123", which co uld
31 // potentially override any other request parameters set.
30 func (b Builder) Render(c context.Context, r *http.Request, p httprouter.Params) (*templates.Args, error) { 32 func (b Builder) Render(c context.Context, r *http.Request, p httprouter.Params) (*templates.Args, error) {
31 // Parse URL parameters. 33 // Parse URL parameters.
32 server := r.FormValue("server") 34 server := r.FormValue("server")
33 if server == "" { 35 if server == "" {
34 server = defaultServer 36 server = defaultServer
35 } 37 }
36 38
37 bucket := p.ByName("bucket") 39 bucket := p.ByName("bucket")
38 if bucket == "" { 40 if bucket == "" {
39 return nil, &miloerror.Error{ 41 return nil, &miloerror.Error{
(...skipping 21 matching lines...) Expand all
61 if err != nil { 63 if err != nil {
62 return nil, err 64 return nil, err
63 } 65 }
64 66
65 // Render into the template 67 // Render into the template
66 args := &templates.Args{ 68 args := &templates.Args{
67 "Builder": result, 69 "Builder": result,
68 } 70 }
69 return args, nil 71 return args, nil
70 } 72 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698