| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | 82 // Note: The builder html template contains self links to "?limit=123", which co
uld |
| 83 // potentially override any other request parameters set. | 83 // potentially override any other request parameters set. |
| 84 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) { |
| 85 master := p.ByName("master") | 85 master := p.ByName("master") |
| 86 if master == "" { | 86 if master == "" { |
| 87 return nil, &miloerror.Error{ | 87 return nil, &miloerror.Error{ |
| 88 » » » Message: "No master", | 88 » » » Message: "No master specified", |
| 89 Code: http.StatusBadRequest, | 89 Code: http.StatusBadRequest, |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 builder := p.ByName("builder") | 92 builder := p.ByName("builder") |
| 93 if builder == "" { | 93 if builder == "" { |
| 94 return nil, &miloerror.Error{ | 94 return nil, &miloerror.Error{ |
| 95 » » » Message: "No builder", | 95 » » » Message: "No builder specified", |
| 96 Code: http.StatusBadRequest, | 96 Code: http.StatusBadRequest, |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 limit, err := settings.GetLimit(r) | 99 limit, err := settings.GetLimit(r) |
| 100 if err != nil { | 100 if err != nil { |
| 101 return nil, err | 101 return nil, err |
| 102 } | 102 } |
| 103 if limit < 0 { | 103 if limit < 0 { |
| 104 limit = 25 | 104 limit = 25 |
| 105 } | 105 } |
| 106 | 106 |
| 107 result, err := builderImpl(c, master, builder, limit) | 107 result, err := builderImpl(c, master, builder, limit) |
| 108 if err != nil { | 108 if err != nil { |
| 109 return nil, err | 109 return nil, err |
| 110 } | 110 } |
| 111 | 111 |
| 112 // Render into the template | 112 // Render into the template |
| 113 args := &templates.Args{ | 113 args := &templates.Args{ |
| 114 "Builder": result, | 114 "Builder": result, |
| 115 } | 115 } |
| 116 return args, nil | 116 return args, nil |
| 117 } | 117 } |
| OLD | NEW |