diff --git a/src/lib/Hydra/Controller/Jobset.pm b/src/lib/Hydra/Controller/Jobset.pm index 961ac0ee..616fc5e2 100644 --- a/src/lib/Hydra/Controller/Jobset.pm +++ b/src/lib/Hydra/Controller/Jobset.pm @@ -49,7 +49,7 @@ sub jobsetIndex { } } - $c->stash->{evals} = getEvals($self, $c, 0, 6); + $c->stash->{evals} = getEvals($self, $c, 0, 5); $c->stash->{systems} = [ $c->stash->{jobset}->builds->search({ iscurrent => 1 }, { select => ["system"], distinct => 1, order_by => "system" }) ]; @@ -327,7 +327,8 @@ sub clone_submit : Chained('jobset') PathPart('clone/submit') Args(0) { sub getEvals { my ($self, $c, $offset, $rows) = @_; - return [ $c->stash->{jobset}->jobsetevals->search( + + my @evals = $c->stash->{jobset}->jobsetevals->search( { hasnewbuilds => 1 }, { order_by => "id DESC" , '+select' => # !!! Slow - should precompute this. @@ -337,10 +338,42 @@ sub getEvals { , "(select count(*) from JobsetEvalMembers where eval = me.id and exists(select 1 from Builds b where b.id = build and b.finished = 1 and b.buildStatus = 0))" ] , '+as' => [ "nrBuilds", "nrScheduled", "nrFinished", "nrSucceeded" ] - , rows => $rows + , rows => $rows + 1 , offset => $offset + }); + + my @res = (); + my $curInputs; + for (my $n = 0; $n < $rows && $n < scalar @evals; $n++) { + my $cur = $evals[$n]; + my $prev = $evals[$n + 1]; + + # Compute what inputs changed between each eval. + my $diff = 0; + my $prevInputs = []; + $curInputs = [ $cur->jobsetevalinputs->search( + { uri => { '!=' => undef }, revision => { '!=' => undef }, altNr => 0 }, + { order_by => "name" }) ] unless defined $curInputs; + if (defined $prev) { + $diff = $cur->get_column("nrSucceeded") - $prev->get_column("nrSucceeded"); + $prevInputs = [ $prev->jobsetevalinputs->search( + { uri => { '!=' => undef }, revision => { '!=' => undef }, altNr => 0 }, + { order_by => "name" }) ]; } - ) ]; + my @changedInputs; + my %prevInputsHash; + $prevInputsHash{$_->name} = $_ foreach @{$prevInputs}; + foreach my $input (@{$curInputs}) { + my $p = $prevInputsHash{$input->name}; + push @changedInputs, $input + if !defined $p || $input->revision != $p->revision || $input->type != $p->type || $input->uri != $p->uri; + } + $curInputs = $prevInputs; + + push @res, { eval => $cur, diff => $diff, changedInputs => [ @changedInputs ] }; + } + + return [@res]; } @@ -357,7 +390,7 @@ sub evals : Chained('jobset') PathPart('evals') Args(0) { $c->stash->{resultsPerPage} = $resultsPerPage; $c->stash->{total} = $c->stash->{jobset}->jobsetevals->search({hasnewbuilds => 1})->count; - $c->stash->{evals} = getEvals($self, $c, ($page - 1) * $resultsPerPage, $resultsPerPage + 1) + $c->stash->{evals} = getEvals($self, $c, ($page - 1) * $resultsPerPage, $resultsPerPage) } diff --git a/src/root/common.tt b/src/root/common.tt index 24cb3237..9345c4de 100644 --- a/src/root/common.tt +++ b/src/root/common.tt @@ -402,22 +402,42 @@ [% END %] -[% BLOCK renderEvals %] +[% BLOCK renderShortRev -%] + [%- IF type == "svn" || type == "svn-checkout" || type == "bzr" || type == "bzr-checkout" -%] + r[%- revision -%] + [%- ELSIF type == "git" -%] + [% revision.substr(0, 7) %] + [%- ELSE -%] + [%- revision -%] + [%- END -%] +[%- END %] + +[% BLOCK renderEvals %] + - [% last = nrShown - 1; FOREACH n IN [0..last]; eval = evals.$n; m = n + 1; next = evals.$m; - link = c.uri_for(c.controller('JobsetEval').action_for('view'), [eval.id]) %] + [%- FOREACH e IN evals; eval = e.eval; + link = c.uri_for(c.controller('JobsetEval').action_for('view'), [eval.id]) -%] + [%- END -%] [%- IF linkToAll -%] - + [%- END -%]
# DateInput changes Success
[% eval.id %]  [% INCLUDE renderDateTime timestamp = eval.timestamp %]  + [%- IF e.changedInputs.size > 0 -%] + [%- sep=''; FOREACH input IN e.changedInputs -%] + [%- sep %] [% input.name %] → [% INCLUDE renderShortRev type=input.type revision=input.revision %] + [%- sep=','; END -%] + [%- ELSE -%] + - + [%- END -%] + [% eval.get_column('nrSucceeded') %] [% eval.get_column('nrBuilds') - eval.get_column('nrSucceeded') - eval.get_column('nrScheduled') %] @@ -426,20 +446,17 @@ [% END %] - [% diff = eval.get_column('nrSucceeded') - next.get_column('nrSucceeded'); - IF diff > 0 %] - +[% diff %] - [% ELSIF diff < 0 && eval.get_column('nrScheduled') == 0 %] - [% diff %] - [% END %] + [%- IF e.diff > 0 -%] + +[% e.diff %] + [%- ELSIF e.diff < 0 && eval.get_column('nrScheduled') == 0 -%] + [% e.diff %] + [%- END -%]
More...
More...
- - [% END %] diff --git a/src/root/jobset-evals.tt b/src/root/jobset-evals.tt index 640bff11..c8bfab1b 100644 --- a/src/root/jobset-evals.tt +++ b/src/root/jobset-evals.tt @@ -5,10 +5,8 @@ uri = c.uri_for(c.controller('Project').action_for('view'), [project.name]) title = project.name %]:[% jobset.name %] -[% nrShown = evals.size > resultsPerPage ? resultsPerPage : evals.size %] -

Showing evaluations [% (page - 1) * resultsPerPage + 1 %] - [% -(page - 1) * resultsPerPage + nrShown %] out of [% total %].

+(page - 1) * resultsPerPage + evals.size %] out of [% total %].

[% INCLUDE renderPager %] diff --git a/src/root/jobset.tt b/src/root/jobset.tt index e832eb58..66f2badf 100644 --- a/src/root/jobset.tt +++ b/src/root/jobset.tt @@ -83,7 +83,7 @@
[% IF !edit && evals.size() > 0 -%]

Most recent evaluations

- [% INCLUDE renderEvals nrShown=evals.size() - 1 linkToAll=c.uri_for(c.controller('Jobset').action_for('evals'), [project.name, jobset.name]) %] + [% INCLUDE renderEvals linkToAll=c.uri_for(c.controller('Jobset').action_for('evals'), [project.name, jobset.name]) %] [% END %] [% IF !edit && activeJobsStatus -%]

Status