This allows zooming on the results of a specific machine or test configuration.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- winetest/build-patterns | 31 ++++++++++++- winetest/patterns.js | 100 ++++++++++++++++++++++++++++++++++++++++ winetest/report.css | 6 +++ 3 files changed, 135 insertions(+), 2 deletions(-) create mode 100644 winetest/patterns.js
diff --git a/winetest/build-patterns b/winetest/build-patterns index d530ad2f8..fc6f7edbe 100755 --- a/winetest/build-patterns +++ b/winetest/build-patterns @@ -20,6 +20,7 @@ use strict; use warnings; use open ':utf8'; use CGI qw(:standard); +use POSIX; # ceil()
use Text::CSV::Encoded; use Time::Piece; @@ -980,7 +981,7 @@ sub write_pattern_line($$$) my ($html, $test, $reportdir) = @_; my $testreport = $test->{testreports}->{$reportdir};
- print $html "<div class='pattern'>"; + print $html "<div class='patline' data-id='$reportdir'><div class='pattern'>";
my $has_newmode; my ($range_symbol, $range_count) = ("", 0); @@ -1086,7 +1087,7 @@ sub write_pattern_line($$$) } my $label = $reportdir; $label = "<b>$label</b>" if ($has_newmode); - print $html "</div> $label\n"; + print $html "</div> $label\n</div>"; }
sub index2symbol($) @@ -1288,6 +1289,7 @@ sub write_patterns_page($$$) <head> <title>$title</title> <link rel="stylesheet" href="/report.css" type="text/css"> + <script type="text/javascript" defer="true" src="/patterns.js"></script> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body> @@ -1462,6 +1464,31 @@ EOF $tests{0}->{desc} .= "</ul>"; if (!$nolist) { + my @table = ("<details><summary>Page cutomization</summary> +<div class='detailsbox'><p>Uncheck the reports you do not want to see on this page.</p> +<table width='100%'>"); + my @reportmap; + for (my $i = 0; $i < @sortedreports; $i++) + { + my $reportdir = $sortedreports[$i]; + push @reportmap, $i if ($pagereports->{$reportdir}); + } + my $count = @reportmap; + for (my $i = 0; $i < ceil($count/4); $i++) + { + push @table, "<tr>"; + for (my $c = 0; $c < $count; $c += ceil($count/4)) + { + my $reportindex = $reportmap[$i + $c]; + last if (!defined $reportindex); + my $reportdir = $sortedreports[$reportindex] || ""; + push @table, "<td><label><input class='reportcb' type='checkbox' id='$reportdir' checked> $reportdir</label></td>"; + } + push @table, "</tr>"; + } + push @table, "</div></table></details>"; + $tests{0}->{desc} .= join("", @table); + $tests{0}->{desc} .= "<p>Unlike the other patterns on this page, the one below shows the number of failed test units for each configuration.</p>"; }
diff --git a/winetest/patterns.js b/winetest/patterns.js new file mode 100644 index 000000000..a70df079e --- /dev/null +++ b/winetest/patterns.js @@ -0,0 +1,100 @@ +/* Hide / show reports on the patterns page + * + * Copyright 2021 Francois Gouget + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + *Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +"use strict"; + +var cbs; + +function refreshPage(changes) +{ + for (let key in changes) + { + const cb = cbs[key]; + if (cb.checked == changes[key]) continue; + + if (changes[key]) + { + cb.patlines.forEach(patline => { + patline.dom.style.display = patline.display; + const test = patline.test; + if (++test.linecount == 1 && test.id != "summary") + test.dom.style.display = test.display; + }); + } + else + { + cb.patlines.forEach(patline => { + patline.dom.style.display = "none"; + const test = patline.test; + if (--test.linecount == 0 && test.id != "summary") + test.dom.style.display = "none"; + }); + } + + cb.checked = changes[key]; + } +} + +function toggledReportCB(e) +{ + const cb = e.target; + const changes = {}; + changes[cb.id] = cb.checked; + refreshPage(changes); +} + +function init() +{ + const changes = {}; + cbs = {}; + document.querySelectorAll("input.reportcb").forEach(domcb => { + cbs[domcb.id] = { checked: true, /* all reports are shown by default */ + display: domcb.style.display, + patlines: [] + }; + changes[domcb.id] = domcb.checked; + domcb.addEventListener('click', toggledReportCB); + }); + + document.querySelectorAll("div.testfile").forEach(domtest => { + const test = { id: domtest.id, + dom: domtest, + display: domtest.style.display, + linecount: 0 + }; + + domtest.querySelectorAll("div.patline").forEach(domline => { + const cb = cbs[domline.getAttribute("data-id")]; + if (cb) + { + cb.patlines.push({ dom: domline, + display: domline.style.display, + test: test + }); + if (cb.checked) test.linecount++; + } + }); + }); + + /* When reloading a page the browser may preserve the checkbox state + * so reapply them to the rest of the page. + */ + refreshPage(changes); +} + +window.addEventListener('load', init); diff --git a/winetest/report.css b/winetest/report.css index 4594c5d49..f193bc3be 100644 --- a/winetest/report.css +++ b/winetest/report.css @@ -70,6 +70,12 @@ table.output td { float: right; }
+.detailsbox { + margin: 5px 1em 0 1em; + padding: 0 5px 5px; + border: 1px solid #601919; +} + .pattern { display: inline-block; font-family: monospace;
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- winetest/build-patterns | 22 +++++++++++++++++++--- winetest/patterns.js | 26 +++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 4 deletions(-)
diff --git a/winetest/build-patterns b/winetest/build-patterns index fc6f7edbe..a1691db3d 100755 --- a/winetest/build-patterns +++ b/winetest/build-patterns @@ -1465,8 +1465,22 @@ EOF if (!$nolist) { my @table = ("<details><summary>Page cutomization</summary> -<div class='detailsbox'><p>Uncheck the reports you do not want to see on this page.</p> -<table width='100%'>"); +<div class='detailsbox'><p>This section lets you select the reports to show on this page.</p><p>"); + if (!$subpage or $subpage eq "-tb-win") + { + push @table, "<label><input id='tbwin' class='groupcb' type='checkbox' checked> Show the TestBot Windows reports</label><br>"; + } + if (!$subpage or $subpage eq "-tb-wine") + { + push @table, "<label><input id='tbwine' class='groupcb' type='checkbox' checked> Show the Testbot Wine reports</label><br>"; + } + if (!$subpage) + { + push @table, "<label><input id='win' class='groupcb' type='checkbox' checked> Show the other Windows reports</label><br> +<label><input id='wine' class='groupcb' type='checkbox' checked> Show the other Wine reports</label>"; + } + push @table, "</p><p>Use the table below to hide specific reports.</p><table width='100%'>"; + my @reportmap; for (my $i = 0; $i < @sortedreports; $i++) { @@ -1482,7 +1496,9 @@ EOF my $reportindex = $reportmap[$i + $c]; last if (!defined $reportindex); my $reportdir = $sortedreports[$reportindex] || ""; - push @table, "<td><label><input class='reportcb' type='checkbox' id='$reportdir' checked> $reportdir</label></td>"; + my $report = $reports{$reportdir}; + my $group = " data-group='". ($report->{tag} =~ /^newtb-/ ? "tb" : "") . ($report->{is_wine} ? "wine" : "win") ."'"; + push @table, "<td><label><input class='reportcb'$group type='checkbox' id='$reportdir' checked> $reportdir</label></td>"; } push @table, "</tr>"; } diff --git a/winetest/patterns.js b/winetest/patterns.js index a70df079e..80ac4b868 100644 --- a/winetest/patterns.js +++ b/winetest/patterns.js @@ -50,6 +50,24 @@ function refreshPage(changes) } }
+function toggledGroupCB(e) +{ + const group = e.target.id; + const checked = e.target.checked; + + const changes = {}; + for (let key in cbs) + { + const cb = cbs[key]; + if (cb.group == group) + { + cb.dom.checked = checked; + changes[key] = checked; + } + } + refreshPage(changes); +} + function toggledReportCB(e) { const cb = e.target; @@ -60,11 +78,17 @@ function toggledReportCB(e)
function init() { + document.querySelectorAll("input.groupcb").forEach(domcb => { + domcb.addEventListener('click', toggledGroupCB); + }); + const changes = {}; cbs = {}; document.querySelectorAll("input.reportcb").forEach(domcb => { - cbs[domcb.id] = { checked: true, /* all reports are shown by default */ + cbs[domcb.id] = { dom: domcb, + checked: true, /* all reports are shown by default */ display: domcb.style.display, + group: domcb.getAttribute("data-group"), patlines: [] }; changes[domcb.id] = domcb.checked;
On Fri, 6 Aug 2021, Francois Gouget wrote:
This allows zooming on the results of a specific machine or test configuration.
Signed-off-by: Francois Gouget fgouget@codeweavers.com
winetest/build-patterns | 31 ++++++++++++- winetest/patterns.js | 100 ++++++++++++++++++++++++++++++++++++++++
It looks like test.winehq.org does not find patterns.js. Given that this is a new file I should probably have mentioned that it may need some special setup for the webserver. I suspect it's just a missing symbolic link somewhere.
Fortunately this does not impact the static HTML. It just means that trying to filter the reports has no effect.
Francois Gouget fgouget@codeweavers.com writes:
On Fri, 6 Aug 2021, Francois Gouget wrote:
This allows zooming on the results of a specific machine or test configuration.
Signed-off-by: Francois Gouget fgouget@codeweavers.com
winetest/build-patterns | 31 ++++++++++++- winetest/patterns.js | 100 ++++++++++++++++++++++++++++++++++++++++
It looks like test.winehq.org does not find patterns.js. Given that this is a new file I should probably have mentioned that it may need some special setup for the webserver. I suspect it's just a missing symbolic link somewhere.
Yes, it should be fixed now.