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

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

Issue 2748073006: Milo Refactor: Remove theme support (Closed)
Patch Set: Fix tests Created 3 years, 9 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 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 // BuilderHandler renders the builder view page.
22 type Builder struct{}
23
24 // GetTemplateName for Builder returns the template name for builder pages.
25 func (b Builder) GetTemplateName(t settings.Theme) string {
26 » return "builder.html"
27 }
28
29 // Render renders builder view page.
30 // Note: The builder html template contains self links to "?limit=123", which co uld 22 // Note: The builder html template contains self links to "?limit=123", which co uld
31 // potentially override any other request parameters set. 23 // potentially override any other request parameters set.
32 func (b Builder) Render(c context.Context, r *http.Request, p httprouter.Params) (*templates.Args, error) { 24 func BuilderHandler(c context.Context, r *http.Request, p httprouter.Params) (*t emplates.Args, error) {
33 // Parse URL parameters. 25 // Parse URL parameters.
34 server := r.FormValue("server") 26 server := r.FormValue("server")
35 if server == "" { 27 if server == "" {
36 server = defaultServer 28 server = defaultServer
37 } 29 }
38 30
39 bucket := p.ByName("bucket") 31 bucket := p.ByName("bucket")
40 if bucket == "" { 32 if bucket == "" {
41 return nil, &miloerror.Error{ 33 return nil, &miloerror.Error{
42 Message: "No bucket", 34 Message: "No bucket",
(...skipping 20 matching lines...) Expand all
63 if err != nil { 55 if err != nil {
64 return nil, err 56 return nil, err
65 } 57 }
66 58
67 // Render into the template 59 // Render into the template
68 args := &templates.Args{ 60 args := &templates.Args{
69 "Builder": result, 61 "Builder": result,
70 } 62 }
71 return args, nil 63 return args, nil
72 } 64 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698