From: Andrew Dunstan Date: Mon, 2 Jan 2012 14:55:01 +0000 (-0800) Subject: add filtering to failures page. X-Git-Url: https://git.exim.org/buildfarm-server.git/commitdiff_plain/2af257e0d895751efaf3d9db9d69b5c5c04c3606 add filtering to failures page. --- diff --git a/cgi-bin/show_failures.pl b/cgi-bin/show_failures.pl index 15b0be5..3169b84 100755 --- a/cgi-bin/show_failures.pl +++ b/cgi-bin/show_failures.pl @@ -19,9 +19,13 @@ use vars qw($dbhost $dbname $dbuser $dbpass $dbport $template_dir); 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; @@ -43,6 +47,38 @@ elsif ($sortby eq 'namenobranch') 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 =<execute($max_days); 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 @@ -103,7 +141,12 @@ $template->process('fstatus.tt', {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; diff --git a/templates/fstatus.tt b/templates/fstatus.tt index 7df7d32..db8555a 100644 --- a/templates/fstatus.tt +++ b/templates/fstatus.tt @@ -21,7 +21,13 @@ See accompanying License file for license details '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 %][% flag %] [% ELSE %][%# flag ; ' ' @@ -38,7 +44,7 @@ See accompanying License file for license details %]

PostgreSQL BuildFarm Recent Failures

- 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.

Use the farm member link for history of that member @@ -47,11 +53,44 @@ See accompanying License file for license details

+
+
+

Filter

+
+ + +
DaysBranch(es)Member(s)Stage(s) 
+> + + + + + + + +
+
+

 

[% FOREACH flagset IN flag_imgs %] @@ -59,7 +98,7 @@ See accompanying License file for license details [% IF loop.count == 7 %][% END %] [% END %]
Legend
-
+
[% brch = "" %] [% IF sortby == 'namenobranch' %]