Allow filtering jobs in eval pages

This commit is contained in:
Eelco Dolstra 2013-08-28 16:07:24 +02:00
parent d0bcaa6284
commit 07747b7e88
2 changed files with 12 additions and 3 deletions

View file

@ -26,6 +26,9 @@ sub view : Chained('eval') PathPart('') Args(0) {
my $eval = $c->stash->{eval}; my $eval = $c->stash->{eval};
$c->stash->{filter} = $c->request->params->{filter} // "";
my $filter = $c->stash->{filter} eq "" ? {} : { job => { ilike => "%" . $c->stash->{filter} . "%" } };
my $compare = $c->req->params->{compare}; my $compare = $c->req->params->{compare};
my $eval2; my $eval2;
@ -62,8 +65,8 @@ sub view : Chained('eval') PathPart('') Args(0) {
|| $a->get_column('system') cmp $b->get_column('system') || $a->get_column('system') cmp $b->get_column('system')
} }
my @builds = $eval->builds->search({}, { columns => [@buildListColumns] }); my @builds = $eval->builds->search($filter, { columns => [@buildListColumns] });
my @builds2 = defined $eval2 ? $eval2->builds->search({}, { columns => [@buildListColumns] }) : (); my @builds2 = defined $eval2 ? $eval2->builds->search($filter, { columns => [@buildListColumns] }) : ();
@builds = sort { cmpBuilds($a, $b) } @builds; @builds = sort { cmpBuilds($a, $b) } @builds;
@builds2 = sort { cmpBuilds($a, $b) } @builds2; @builds2 = sort { cmpBuilds($a, $b) } @builds2;

View file

@ -36,6 +36,12 @@ c.uri_for(c.controller('JobsetEval').action_for('view'),
<div id="tabs-status" class="tab-pane active"> <div id="tabs-status" class="tab-pane active">
<form class="form-search">
<input name="filter" type="text" class="input-large search-query" placeholder="Search jobs by name..." [% HTML.attributes(value => filter) %]/>
<input name="compare" type="hidden" [% HTML.attributes(value => otherEval.id) %]/>
<input name="full" type="hidden" [% HTML.attributes(value => full) %]/>
</form>
[% BLOCK renderSome %] [% BLOCK renderSome %]
[% size = builds.size; max = full ? size : 30; %] [% size = builds.size; max = full ? size : 30; %]
[% INCLUDE renderBuildListBody builds=builds.slice(0, (size > max ? max : size) - 1) [% INCLUDE renderBuildListBody builds=builds.slice(0, (size > max ? max : size) - 1)
@ -96,7 +102,7 @@ c.uri_for(c.controller('JobsetEval').action_for('view'),
[% IF c.user_exists %] [% IF c.user_exists %]
<p> <p>
<a class="btn" href="[% c.uri_for(c.controller('JobsetEval').action_for('release'), [eval.id]) %]">Release</a> <a class="btn" href="[% c.uri_for(c.controller('JobsetEval').action_for('release'), [eval.id]) %]">Release</a>
</p> </p>
[% END %] [% END %]