Skip to content

Commit

Permalink
Add 'match' query parameter for index page
Browse files Browse the repository at this point in the history
  • Loading branch information
okurz committed Sep 15, 2016
1 parent 14305d0 commit fa2c138
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/OpenQA/WebAPI/Controller/Main.pm
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,12 @@ sub index {
my ($self) = @_;

my $limit_builds = $self->param('limit_builds') // 3;
my $match = $self->param('match');
my @results;

my $groups = $self->db->resultset('JobGroups')->search({}, {order_by => qw/name/});
while (my $group = $groups->next) {
next unless (!$match || $group->name =~ /$match/);
my $res = $self->_group_result($group, $limit_builds);
if (%$res) {
$res->{_group} = $group;
Expand Down
4 changes: 4 additions & 0 deletions t/ui/14-dashboard.t
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ is($driver->find_element('#more_builds b', 'css')->get_text(), 400, 'limited to
$driver->find_element('tagged', 'link_text')->click();
is(scalar @{$driver->find_elements('h4', 'css')}, 0, 'no tagged builds exist');

is($driver->get($baseurl . '?match=test'), 1, 'index page accepts match parameter to filter job groups');
is(scalar @{$driver->find_elements('h4', 'css')}, 1, 'only one job group shown');
is($driver->find_element('opensuse test', 'link_text')->get_text, 'opensuse test');

#t::ui::PhantomTest::make_screenshot('mojoResults.png');

t::ui::PhantomTest::kill_phantom();
Expand Down

0 comments on commit fa2c138

Please sign in to comment.