Skip to content

Commit

Permalink
Console view: Move some html from python to jinja-template + tweaks
Browse files Browse the repository at this point in the history
 * use &nbsp; to preserve spaces in comments on console without using <pre> (looks ugly)
 * show offline in different color from exception + add to legend
 * minor css tweaks
  • Loading branch information
marcus-sonestedt committed Feb 2, 2010
1 parent 9d184ee commit 05ba657
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 32 deletions.
61 changes: 32 additions & 29 deletions buildbot/status/web/console.py
Expand Up @@ -222,31 +222,34 @@ def stripRevisions(self, allChanges, numRevs, branch, devName):

def getBuildDetails(self, request, builderName, build):
"""Returns an HTML list of failures for a given build."""
details = ""
if build.getLogs():
for step in build.getSteps():
(result, reason) = step.getResults()
if result == builder.FAILURE:
name = step.getName()

# Remove html tags from the error text.
stripHtml = re.compile(r'<.*?>')
strippedDetails = stripHtml .sub('', ' '.join(step.getText()))

details += "<li> %s : %s. \n" % (builderName, strippedDetails)
if step.getLogs():
details += "[ "
for log in step.getLogs():
logname = log.getName()
logurl = request.childLink(
"../builders/%s/builds/%s/steps/%s/logs/%s" %
(urllib.quote(builderName),
build.getNumber(),
urllib.quote(name),
urllib.quote(logname)))
details += "<a href=\"%s\">%s</a> " % (logurl,
log.getName())
details += "]"
details = {}
if not build.getLogs():
return details

for step in build.getSteps():
(result, reason) = step.getResults()
if result == builder.FAILURE:
name = step.getName()

# Remove html tags from the error text.
stripHtml = re.compile(r'<.*?>')
strippedDetails = stripHtml.sub('', ' '.join(step.getText()))

details['buildername'] = builderName
details['status'] = strippedDetails
details['reason'] = reason
logs = details['logs'] = []

if step.getLogs():
for log in step.getLogs():
logname = log.getName()
logurl = request.childLink(
"../builders/%s/builds/%s/steps/%s/logs/%s" %
(urllib.quote(builderName),
build.getNumber(),
urllib.quote(name),
urllib.quote(logname)))
logs.append(dict(url=logurl, name=logname))
return details

def getBuildsForRevision(self, request, builder, builderName, lastRevision,
Expand Down Expand Up @@ -448,7 +451,7 @@ def displaySlaveLine(self, status, builderList, debugInfo):
state, builds = status.getBuilder(builder).getState()
# Check if it's offline, if so, the box is purple.
if state == "offline":
s["color"] = "exception"
s["color"] = "offline"
else:
# If not offline, then display the result of the last
# finished build.
Expand All @@ -469,7 +472,7 @@ def displayStatusLine(self, builderList, allBuilds, revision, debugInfo):
first build "revision" was in. Returns an HTML list of errors that
happened during these builds."""

details = ""
details = []
nbSlaves = 0
for category in builderList:
nbSlaves += len(builderList[category])
Expand Down Expand Up @@ -514,7 +517,7 @@ def displayStatusLine(self, builderList, allBuilds, revision, debugInfo):
url = "./waterfall"
title = builder
tag = ""
current_details = None
current_details = {}
if introducedIn:
current_details = introducedIn.details or ""
url = "./buildstatus?builder=%s&number=%s" % (urllib.quote(builder),
Expand Down Expand Up @@ -544,7 +547,7 @@ def displayStatusLine(self, builderList, allBuilds, revision, debugInfo):
# If the box is red, we add the explaination in the details
# section.
if current_details and resultsClass == "failure":
details += current_details
details.append(current_details)

return (builds, details)

Expand Down
10 changes: 9 additions & 1 deletion buildbot/status/web/files/default.css
Expand Up @@ -354,7 +354,7 @@ div.BuildWaterfall {
border-color: #C29D46;
}

.exception,td.offline {
.exception {
color: #FFFFFF;
background-color: #f6f;
border-color: #ACA0B3;
Expand All @@ -366,6 +366,13 @@ div.BuildWaterfall {
border-color: #C5C56D;
}

.offline,td.offline {
color: #FFFFFF;
background-color: #777777;
border-color: #dddddd;
}


.start {
border-bottom-left-radius: 10px;
-webkit-border-bottom-left-radius: 10px;
Expand All @@ -379,6 +386,7 @@ div.BuildWaterfall {
border-width: 1px;
border-style: solid;
border-color: #aaa;
background-color: #fff;
}

.closed {
Expand Down
11 changes: 9 additions & 2 deletions buildbot/status/web/templates/console.html
Expand Up @@ -100,6 +100,7 @@ <h1>Console View</h1>
<td class='legend warnings' title='It was failing before, and it is still failing. Make sure you did not introduce new regressions'>Failed&nbsp;Again</td>
<td class='legend running' title='The tests are still running'>Running</td>
<td class='legend exception' title='Something went wrong with the test, there is no result'>Exception</td>
<td class='legend offline' title='The builder is offline, as there are no slaves connected to it'>Offline</td>
<td class='legend notstarted' title='No result yet.'>No&nbsp;data</td>
</tr>
</table>
Expand Down Expand Up @@ -204,15 +205,21 @@ <h1>Console View</h1>

<tr>
<td colspan="{{ r.span }}" class='DevComment {{ alt }}'>
{{ r.comments|changecomment|replace('\n', '<br/>') }}
{{ r.comments|changecomment|replace('\n', '<br/>').replace(' ','&nbsp;') }}
</td>
</tr>

{% if r.details %}
<tr>
<td colspan="{{ r.span }}" class='DevDetails {{ alt }}'>
<ul style='margin: 0px; padding: 0 0 0 1.5em;'>
{{ r.details }}
{% for d in r.details %}
<li>{{ d.buildername }}: {{ d.status }} - &nbsp;
{%- for l in d.logs -%}
<a href="{{ l.url }}">{{ l.name }}</a>
{%- endfor -%}
</li>
{% endfor %}
</ul>
</td>
</tr>
Expand Down

0 comments on commit 05ba657

Please sign in to comment.