Skip to content

Commit

Permalink
Add 'group' 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 fa2c138 commit b38e41e
Show file tree
Hide file tree
Showing 2 changed files with 5 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 @@ -120,11 +120,13 @@ sub index {

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

my $groups = $self->db->resultset('JobGroups')->search({}, {order_by => qw/name/});
while (my $group = $groups->next) {
next unless (!$match || $group->name =~ /$match/);
next unless (!$groups[0] || grep { $group->name eq $_ } @groups);
my $res = $self->_group_result($group, $limit_builds);
if (%$res) {
$res->{_group} = $group;
Expand Down
3 changes: 3 additions & 0 deletions t/ui/14-dashboard.t
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ 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');
is($driver->get($baseurl . '?group=opensuse test'), 1, 'also group parameter works');
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');

Expand Down

0 comments on commit b38e41e

Please sign in to comment.