require "$ENV{BFConfDir}/BuildFarmWeb.pl";
my $query = new CGI;
-my @members = $query->param('member');
+my @members = grep {$_ ne "" } $query->param('member');
map { s/[^a-zA-Z0-9_ -]//g; } @members;
my $max_days = $query->param('max_days') + 0 || 10;
+my @branches = grep {$_ ne "" } $query->param('branch');
+map { s/[^a-zA-Z0-9_ -]//g; } @branches;
+my @stages = grep {$_ ne "" } $query->param('stage');
+map { s/[^a-zA-Z0-9_ -]//g; } @stages;
my $dsn="dbi:Pg:dbname=$dbname";
$dsn .= ";host=$dbhost" if $dbhost;
my $db = DBI->connect($dsn,$dbuser,$dbpass,{pg_expand_array => 0})
or die("$dsn,$dbuser,$dbpass,$!");
+my $get_all_branches = qq{
+
+ select distinct branch
+ from nrecent_failures
+ where branch <> 'HEAD'
+ order by branch desc
+
+};
+
+my $all_branches = $db->selectcol_arrayref($get_all_branches);
+unshift (@$all_branches,'HEAD');
+
+my $get_all_members = qq{
+
+ select distinct sysname
+ from nrecent_failures
+ order by sysname
+
+};
+
+my $all_members = $db->selectcol_arrayref($get_all_members);
+
+my $get_all_stages = qq{
+
+ select distinct stage
+ from build_status
+ join nrecent_failures using (sysname,snapshot,branch)
+
+};
+
+my $all_stages = $db->selectcol_arrayref($get_all_stages);
+
my $statement =<<EOS;
while (my $row = $sth->fetchrow_hashref)
{
next if (@members && ! grep {$_ eq $row->{sysname} } @members);
+ next if (@stages && ! grep {$_ eq $row->{stage} } @stages);
+ next if (@branches && ! grep {$_ eq $row->{branch} } @branches);
$row->{build_flags} =~ s/^\{(.*)\}$/$1/;
$row->{build_flags} =~ s/,/ /g;
# enable-integer-datetimes is now the default
{statrows=>$statrows,
sortby => $sortby,
max_days => $max_days,
- members=> \@members} );
+ all_branches => $all_branches,
+ all_members => $all_members,
+ all_stages => $all_stages,
+ qmembers=> \@members,
+ qbranches => \@branches,
+ qstages => \@stages} );
exit;
'thread-safety' => '/img/threads.gif',
'integer-datetimes' = '/img/days.png',
git => '/img/git.png',
- }
+ };
+
+ filter = '';
+ IF max_days ; filter = 'max_days=' _ max_days ; END ;
+ FOREACH qmemb IN qmembers ; IF filter ; filter = "$filter&" ; END ; filter = filter _ 'member=' _ qmemb ; END ;
+ FOREACH qstage IN qstages ; IF filter ; filter = "$filter&" ; END ; filter = filter _ 'stage=' _ qstage ; END ;
+ FOREACH qbranch IN qbranches ; IF filter ; filter = "$filter&" ; END ; filter = filter _ 'branch=' _ qbranch ; END ;
-%]
[%- BLOCK img ; IF flag == 'depend' or flag == 'gnu-ld' ; ; ELSIF flag_imgs.$flag %]<img src="[% flag_imgs.$flag %]" title="[% flag %]" alt="[% flag %]" height="16" width="16" class="inline" align="bottom" /> [% ELSE %][%#
flag ; ' '
%]
<h1>PostgreSQL BuildFarm Recent Failures</h1>
<p>
- Shown here are build failures that occurred in the last [% max_days %] days. For a longer (or shorter) time span, up to 90 days, add a query parameter of "max_days=nn".
+ Shown here are build failures that occurred in the last [% max_days %] days.
</p>
<p>
Use the farm member link for history of that member
<div class="nav">
<ul>
- <li [% IF sortby != 'name' && sortby != 'namenobranch' %] id='thismenu' [% END %]><a href="/cgi-bin/show_failures.pl" title="Sort By Branch, Date">Sort By Branch, Date</a></li>
- <li [% IF sortby == 'name' %] id='thismenu' [% END %]><a href="/cgi-bin/show_failures.pl?sortby=name" title="Sort By Branch, Name">Sort By Branch, Name</a></li>
- <li [% IF sortby == 'namenobranch' %] id='thismenu' [% END %]><a href="/cgi-bin/show_failures.pl?sortby=namenobranch" title="Sort By Name">Sort By Name</a></li>
+ <li [% IF sortby != 'name' && sortby != 'namenobranch' %] id='thismenu' [% END %]><a href="/cgi-bin/show_failures.pl[% IF filter ; '?' _ filter; END %]" title="Sort By Branch, Date">Sort By Branch, Date</a></li>
+ <li [% IF sortby == 'name' %] id='thismenu' [% END %]><a href="/cgi-bin/show_failures.pl?sortby=name[% IF filter ; "&$filter"; END %]" title="Sort By Branch, Name">Sort By Branch, Name</a></li>
+ <li [% IF sortby == 'namenobranch' %] id='thismenu' [% END %]><a href="/cgi-bin/show_failures.pl?sortby=namenobranch[% IF filter ; "&$filter"; END %]" title="Sort By Name">Sort By Name</a></li>
</ul>
</div>
+<br />
+<table border="0"><tr><td>
+<h3>Filter</h3>
+<form action="/cgi-bin/show_failures.pl" method="get">
+<table border="none">
+<tr><td>Days</td><td>Branch(es)</td><td>Member(s)</td><td>Stage(s)</td><td> </td></tr>
+<tr><td>
+<select name="max_days">
+[% maxday_range = [ 3 .. 90 ] ; FOREACH maxdays IN maxday_range %]<option>[% maxdays %]</option>
+[% END %]
+</selecto</td><td>>
+<select name="branch" multiple="multiple">
+<option value="">All</option>
+[% FOREACH sbranch IN all_branches %]<option>[% sbranch %]</option>
+[% END %]
+</select>
+</td><td>
+<select name="member" multiple="multiple">
+<option value="">All</option>
+[% FOREACH smemb IN all_members %]<option>[% smemb %]</option>
+[% END %]
+</select>
+</td><td>
+<select name="stage" multiple="multiple">
+<option value="">All</option>
+[% FOREACH sstage IN all_stages %]<option>[% sstage %]</option>
+[% END %]
+</select>
+</td><td>
+<input type="submit" name="filter" value="Submit" />
+</td></tr></table>
+</form>
+</td></tr><tr><td>
<h3> </h3>
<table><tr><th class="head" rowspan="2">Legend</th>
[% FOREACH flagset IN flag_imgs %]
[% IF loop.count == 7 %]</tr><tr>[% END %]
[% END %]
</tr></table>
-<br />
+</td></tr></table>
<table cellspacing="0">
[% brch = "" %]
[% IF sortby == 'namenobranch' %]