Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/package selection #66

Open
wants to merge 2 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions 3.8/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,35 @@ function toggle(theClass) {
location.hash = "#show=" + on.join(",");
}

function setPackagesVisible(){
var i,j;

var urlstring = window.location.href
var url = new URL(urlstring);
var pkgstring = url.searchParams.get("packages");

// Skip if no packages are selected
if (pkgstring == null || pkgstring == "" || pkgstring == "/") {
return;
}

// At the beginning of the summary report html is some strange code
// to always add a trailling slash. Remove it from parameter
pkgstring = pkgstring.replace(/\/+$/, "");
var pkgs = pkgstring.split(",");

// Hide all packages
var trs = document.querySelectorAll('html>body>table>tbody>tr');
for (i = 0; i < trs.length; ++i) {
trs[i].style.display = "none";
}

// Only show selected ones
for (j in pkgs) {
var pkgselector = "[data-pkg=" + pkgs[j] + "]";
var trs = document.querySelectorAll(pkgselector);
for (i = 0; i < trs.length; ++i) {
trs[i].style.display = "table-row";
}
}
}
6 changes: 4 additions & 2 deletions BBS-report.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ def write_pkg_allstatuses_asfullTRs(out, pkg, pkg_pos, nb_pkgs, leafreport_ref):
classes = "odd"
statuses = BBSreportutils.get_distinct_statuses_from_db(pkg)
classes += statuses2classes(statuses)
out.write('<TR class="%s header">' % classes)
out.write('<TR class="%s header" data-pkg="%s">' % (classes, pkg))
out.write('<TD>Package <B>%d</B>/%d</TD>' % (pkg_pos, nb_pkgs))
out.write('<TD style="text-align: left">Hostname</TD>')
out.write('<TD style="text-align: left; width: 290px">OS&nbsp;/&nbsp;Arch</TD>')
Expand All @@ -426,7 +426,7 @@ def write_pkg_allstatuses_asfullTRs(out, pkg, pkg_pos, nb_pkgs, leafreport_ref):
nb_nodes = len(BBSreportutils.NODES)
is_first = True
for node in BBSreportutils.NODES:
out.write('<TR class="%s">' % classes)
out.write('<TR class="%s"> data-pkg="%s"' % (classes, pkg))
if is_first:
pkgname_html = pkgname_to_HTML(pkg)
version = BBSreportutils.get_pkg_field_from_meat_index(pkg, 'Version')
Expand Down Expand Up @@ -612,6 +612,8 @@ def write_HTML_header(out, page_title=None, css_file=None, js_file=None):
out.write('<script language="javascript">\n')
out.write('if (!/\.html$|\/$|#/.test(window.location.href))\n')
out.write(' window.location.href = window.location.href + "/";\n')
out.write('// Support ?packages=xcms,mzR,CAMERA URL parameter\n')
out.write('window.onload = setPackagesVisible();\n')
out.write('</script>\n')
out.write('<META http-equiv="Content-Type" content="text/html; charset=UTF-8">\n')
title = BBSreportutils.report_title
Expand Down