In the jobset evals lists, show what inputs changed between consecutive evals
This commit is contained in:
parent
b9824ca422
commit
0daba6bb89
|
@ -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)
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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" -%]
|
||||
<tt>[% revision.substr(0, 7) %]</tt>
|
||||
[%- ELSE -%]
|
||||
<tt>[%- revision -%]</tt>
|
||||
[%- END -%]
|
||||
[%- END %]
|
||||
|
||||
|
||||
[% BLOCK renderEvals %]
|
||||
<table class="tablesorter table table-condensed table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Date</th>
|
||||
<th>Input changes</th>
|
||||
<th colspan='2'>Success</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
[% 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]) -%]
|
||||
<tr class="clickable" onclick="window.location = '[% link %]'">
|
||||
<td><a href="[% link %]">[% eval.id %]</a> </td>
|
||||
<td>[% INCLUDE renderDateTime timestamp = eval.timestamp %] </td>
|
||||
<td>
|
||||
[%- 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 -%]
|
||||
</td>
|
||||
<td align='right'>
|
||||
<span class="label label-success">[% eval.get_column('nrSucceeded') %]</span>
|
||||
<span class="label label-important">[% eval.get_column('nrBuilds') - eval.get_column('nrSucceeded') - eval.get_column('nrScheduled') %]</span>
|
||||
|
@ -426,20 +446,17 @@
|
|||
[% END %]
|
||||
</td>
|
||||
<td align='right'>
|
||||
[% diff = eval.get_column('nrSucceeded') - next.get_column('nrSucceeded');
|
||||
IF diff > 0 %]
|
||||
<span class='label label-success'><strong>+[% diff %]</strong></span>
|
||||
[% ELSIF diff < 0 && eval.get_column('nrScheduled') == 0 %]
|
||||
<span class='label label-important'><strong>[% diff %]</strong></span>
|
||||
[% END %]
|
||||
[%- IF e.diff > 0 -%]
|
||||
<span class='label label-success'><strong>+[% e.diff %]</strong></span>
|
||||
[%- ELSIF e.diff < 0 && eval.get_column('nrScheduled') == 0 -%]
|
||||
<span class='label label-important'><strong>[% e.diff %]</strong></span>
|
||||
[%- END -%]
|
||||
</td>
|
||||
</tr>
|
||||
[%- END -%]
|
||||
[%- IF linkToAll -%]
|
||||
<tr><td class="centered" colspan="4"><a href="[% linkToAll %]"><em>More...</em></a></td></tr>
|
||||
<tr><td class="centered" colspan=54"><a href="[% linkToAll %]"><em>More...</em></a></td></tr>
|
||||
[%- END -%]
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
[% END %]
|
||||
|
|
|
@ -5,10 +5,8 @@
|
|||
uri = c.uri_for(c.controller('Project').action_for('view'), [project.name])
|
||||
title = project.name %]:[% jobset.name %]</tt></h2>
|
||||
|
||||
[% nrShown = evals.size > resultsPerPage ? resultsPerPage : evals.size %]
|
||||
|
||||
<p>Showing evaluations [% (page - 1) * resultsPerPage + 1 %] - [%
|
||||
(page - 1) * resultsPerPage + nrShown %] out of [% total %].</p>
|
||||
(page - 1) * resultsPerPage + evals.size %] out of [% total %].</p>
|
||||
|
||||
[% INCLUDE renderPager %]
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
<div id="tabs-information" class="tab-pane active">
|
||||
[% IF !edit && evals.size() > 0 -%]
|
||||
<h2>Most recent evaluations</h2>
|
||||
[% 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 -%]
|
||||
<h2>Status</h2>
|
||||
|
|
Loading…
Reference in a new issue