| OLD | NEW |
| (Empty) |
| 1 # This file is part of Buildbot. Buildbot is free software: you can | |
| 2 # redistribute it and/or modify it under the terms of the GNU General Public | |
| 3 # License as published by the Free Software Foundation, version 2. | |
| 4 # | |
| 5 # This program is distributed in the hope that it will be useful, but WITHOUT | |
| 6 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
| 7 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
| 8 # details. | |
| 9 # | |
| 10 # You should have received a copy of the GNU General Public License along with | |
| 11 # this program; if not, write to the Free Software Foundation, Inc., 51 | |
| 12 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
| 13 # | |
| 14 # Copyright Buildbot Team Members | |
| 15 | |
| 16 from buildbot.status.web.base import HtmlResource, IBox | |
| 17 | |
| 18 class BuildStatusStatusResource(HtmlResource): | |
| 19 def __init__(self, categories=None): | |
| 20 HtmlResource.__init__(self) | |
| 21 | |
| 22 def content(self, request, ctx): | |
| 23 """Display a build in the same format as the waterfall page. | |
| 24 The HTTP GET parameters are the builder name and the build | |
| 25 number.""" | |
| 26 | |
| 27 status = self.getStatus(request) | |
| 28 request.setHeader('Cache-Control', 'no-cache') | |
| 29 | |
| 30 # Get the parameters. | |
| 31 name = request.args.get("builder", [None])[0] | |
| 32 number = request.args.get("number", [None])[0] | |
| 33 if not name or not number: | |
| 34 return "builder and number parameter missing" | |
| 35 number = int(number) | |
| 36 | |
| 37 # Check if the builder in parameter exists. | |
| 38 try: | |
| 39 builder = status.getBuilder(name) | |
| 40 except: | |
| 41 return "unknown builder" | |
| 42 | |
| 43 # Check if the build in parameter exists. | |
| 44 build = builder.getBuild(int(number)) | |
| 45 if not build: | |
| 46 return "unknown build %s" % number | |
| 47 | |
| 48 rows = ctx['rows'] = [] | |
| 49 | |
| 50 # Display each step, starting by the last one. | |
| 51 for i in range(len(build.getSteps()) - 1, -1, -1): | |
| 52 step = build.getSteps()[i] | |
| 53 if step.isStarted() and step.getText() and not step.isHidden(): | |
| 54 rows.append(IBox(step).getBox(request).td(align="center")) | |
| 55 | |
| 56 # Display the bottom box with the build number in it. | |
| 57 ctx['build'] = IBox(build).getBox(request).td(align="center") | |
| 58 | |
| 59 template = request.site.buildbot_service.templates.get_template("buildst
atus.html") | |
| 60 data = template.render(**ctx) | |
| 61 | |
| 62 # We want all links to display in a new tab/window instead of in the | |
| 63 # current one. | |
| 64 # TODO: Move to template | |
| 65 data = data.replace('<a ', '<a target="_blank"') | |
| 66 return data | |
| OLD | NEW |