Allow comparing an eval against the jobset one day/week/month before

This commit is contained in:
Eelco Dolstra 2013-08-28 15:46:08 +02:00
parent ccc09c565e
commit d0bcaa6284
2 changed files with 12 additions and 1 deletions

View file

@ -36,6 +36,11 @@ sub view : Chained('eval') PathPart('') Args(0) {
if ($compare =~ /^\d+$/) {
$eval2 = $c->model('DB::JobsetEvals')->find($compare)
or notFound($c, "Evaluation $compare doesn't exist.");
} elsif ($compare =~ /^-(\d+)$/) {
my $t = int($1);
$eval2 = $c->stash->{jobset}->jobsetevals->find(
{ hasnewbuilds => 1, timestamp => {'<=', $eval->timestamp - $t} },
{ order_by => "timestamp desc", rows => 1});
} elsif (defined $compare && $compare =~ /^($jobsetNameRE)$/) {
my $j = $c->stash->{project}->jobsets->find({name => $compare})
or notFound($c, "Jobset $compare doesn't exist.");

View file

@ -4,7 +4,11 @@
<div class="btn-group pull-right">
<a class="btn btn-primary dropdown-toggle" data-toggle="dropdown" href="#"><i class="icon-white icon-eye-open"></i> Compare to...</a>
<ul class="dropdown-menu">
<li><a href="?">Preceding evaluation in the same jobset</tt></a></li>
<li><a href="?">Preceding evaluation in this jobset</tt></a></li>
<li class="divider"></li>
<li><a href="?compare=-[% 24 * 60 * 60 %]">This jobset <strong>one day</strong> earlier</tt></a></li>
<li><a href="?compare=-[% 7 * 24 * 60 * 60 %]">This jobset <strong>one week</strong> earlier</tt></a></li>
<li><a href="?compare=-[% 31 * 24 * 60 * 60 %]">This jobset <strong>one month</strong> earlier</tt></a></li>
[% IF project.jobsets_rs.count > 1 %]
<li class="divider"></li>
[% FOREACH j IN project.jobsets.sort('name'); IF j.name != jobset.name %]
@ -19,6 +23,8 @@
project=otherEval.jobset.project.name jobset=otherEval.jobset.name %] evaluation <a href="[%
c.uri_for(c.controller('JobsetEval').action_for('view'),
[otherEval.id]) %]">[% otherEval.id %]</a>.</p>
[% ELSE %]
<div class="alert">Couldn't find an evaluation to compare to.</div>
[% END %]
<ul class="nav nav-tabs">