add tooltips with failed test links for failed images

Oh man I love this so much! Huge thanks to Robery Mayr for help
with the HTML/CSS here. You can now hover over the link for any
image with test fails to show a tooltip with links to each of
the failed tests in openQA, or the Autocloud test output page.
Super cool. Woohoo. All in pure HTML/CSS, no stinky JS here.
This commit is contained in:
Adam Williamson 2016-04-14 17:22:45 -07:00
commit 9398d9969e

View file

@ -35,7 +35,10 @@ th {background-color: lightgrey;}
.relheader {background-color: black; color: white;}
.groupheader {background-color: lightskyblue;}
.failedlink {color: red;}
.failedcell {line-height: 90%;}
.failcell {position: relative; display: inline-block;}
.faillinks {display: none; border: 1px solid #c8c8c8; left: 100px; position: absolute; z-index: 1; white-space: nowrap; background-color: #f9f9f9; padding: 10px;}
.faillinks a {display: block;}
.failcell:hover .faillinks {display: block;}
.passedlink {color: green;}
.key {font-size: 0.9em; color: dimgrey;}
</style>
@ -99,6 +102,41 @@ def datagrepper_query(topics, days):
nxt = False
return messages
def get_cell(image):
"""Build a results table cell for an image. This is a bit complex
and looks pretty messy in-line in add_group, so it's split out
here."""
# YAY partial, we all love partial. We want a link to the image
# whatever, but its class differs depending on test status.
lnpart = functools.partial(Element, 'a', image['compose'], href=image['url'])
# simple cases first: pass or none. Just add the link.
if image.testspass is True:
content = lnpart(cssclass='passedlink')
elif image.testspass is None:
content = lnpart(cssclass='passedlink')
else:
# fail. this case is more complex. we need the contents of the
# cell to include the failed test links popups.
# First build the links div:
faillinks = ['Failed tests:']
if image['openqa']:
fails = [(str(job['id']), job['test']) for job in image['openqa']
if job['result'] not in ('passed', 'softfail')]
if fails:
faillinks.extend(
[Element('a', "openQA: {0} ({1})".format(jobid, jobtest),
href='https://openqa.fedoraproject.org/tests/{0}'.format(jobid))
for (jobid, jobtest) in fails])
elif image['autocloud']:
job = str(image['autocloud']['job_id'])
url = 'https://apps.fedoraproject.org/autocloud/jobs/{0}/output'.format(job)
faillinks.append(Element('a', "Autocloud: " + job, href=url))
faillinksdiv = Element('div', faillinks, cssclass='faillinks')
# now wrap it and the image link in the cell div:
imglink = lnpart(cssclass='failedlink')
content = Element('div', [imglink, faillinksdiv], cssclass='failcell')
return Element('td', content)
## ERROR CLASSES
@ -194,31 +232,7 @@ class ReleaseTable(Element):
# first cell: arch name
cells = [Element('td', arch)]
for image in group[arch]:
# YAY partial, we all love partial
lnpart = functools.partial(Element, 'a', image['compose'], href=image['url'])
# add a cell for each image in the list, with
# appropriate class for its test results
if image.testspass is True:
links = [lnpart(cssclass='passedlink')]
elif image.testspass is False:
links = [lnpart(cssclass='failedlink')]
if image['openqa']:
fails = [str(job['id']) for job in image['openqa']
if job['result'] not in ('passed', 'softfail')]
if fails:
links.extend((Element('br'), 'Fails: '))
links.extend(
[Element('a', job,
href='https://openqa.fedoraproject.org/tests/{0}'.format(job))
for job in fails])
elif image['autocloud']:
job = str(image['autocloud']['job_id'])
links.extend((Element('br'), 'Fails: '))
url = 'https://apps.fedoraproject.org/autocloud/jobs/{0}'.format(job)
links.append(Element('a', job, href=url))
else:
links = [lnpart()]
cells.append(Element('td', links))
cells.append(get_cell(image))
# pad the row with empty cells (this is when we don't
# have a 'last known good' as no image passed tests)
while len(cells) < 3: