| OLD | NEW |
| 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 "os" | 10 "os" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 } | 72 } |
| 73 return args, nil | 73 return args, nil |
| 74 } | 74 } |
| 75 | 75 |
| 76 // GetTemplateName returns the template name for builder pages. | 76 // GetTemplateName returns the template name for builder pages. |
| 77 func (b Builder) GetTemplateName(t settings.Theme) string { | 77 func (b Builder) GetTemplateName(t settings.Theme) string { |
| 78 return "builder.html" | 78 return "builder.html" |
| 79 } | 79 } |
| 80 | 80 |
| 81 // Render renders the buildbot builder page. | 81 // Render renders the buildbot builder page. |
| 82 // Note: The builder html template contains self links to "?limit=123", which co
uld |
| 83 // potentially override any other request parameters set. |
| 82 func (b Builder) Render(c context.Context, r *http.Request, p httprouter.Params)
(*templates.Args, error) { | 84 func (b Builder) Render(c context.Context, r *http.Request, p httprouter.Params)
(*templates.Args, error) { |
| 83 master := p.ByName("master") | 85 master := p.ByName("master") |
| 84 if master == "" { | 86 if master == "" { |
| 85 return nil, &miloerror.Error{ | 87 return nil, &miloerror.Error{ |
| 86 Message: "No master", | 88 Message: "No master", |
| 87 Code: http.StatusBadRequest, | 89 Code: http.StatusBadRequest, |
| 88 } | 90 } |
| 89 } | 91 } |
| 90 builder := p.ByName("builder") | 92 builder := p.ByName("builder") |
| 91 if builder == "" { | 93 if builder == "" { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 106 if err != nil { | 108 if err != nil { |
| 107 return nil, err | 109 return nil, err |
| 108 } | 110 } |
| 109 | 111 |
| 110 // Render into the template | 112 // Render into the template |
| 111 args := &templates.Args{ | 113 args := &templates.Args{ |
| 112 "Builder": result, | 114 "Builder": result, |
| 113 } | 115 } |
| 114 return args, nil | 116 return args, nil |
| 115 } | 117 } |
| OLD | NEW |