From c9ac7746b20ac8071d5541d4911dfe3b69ce36d9 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 21 Feb 2013 18:49:57 +0100 Subject: [PATCH] Allow showing all evaluations that contain a given build --- src/lib/Hydra/Controller/Build.pm | 20 +++++++++++++++++++- src/root/build.tt | 2 +- src/root/common.tt | 4 ++-- src/root/evals.tt | 5 ++++- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/lib/Hydra/Controller/Build.pm b/src/lib/Hydra/Controller/Build.pm index 6bd7c992..8f90af43 100644 --- a/src/lib/Hydra/Controller/Build.pm +++ b/src/lib/Hydra/Controller/Build.pm @@ -559,7 +559,7 @@ sub clone_submit : Chained('build') PathPart('clone/submit') Args(0) { } -sub get_info : Chained('build') PathPart('api/get-info') Args(0) { +sub get_info : Chained('build') PathPart('api/get-info') Args(0) { my ($self, $c) = @_; my $build = $c->stash->{build}; # !!! strip the json prefix @@ -571,4 +571,22 @@ sub get_info : Chained('build') PathPart('api/get-info') Args(0) { } +sub get_info : Chained('build') PathPart('evals') Args(0) { + my ($self, $c) = @_; + + $c->stash->{template} = 'evals.tt'; + + my $page = int($c->req->param('page') || "1") || 1; + + my $resultsPerPage = 20; + + my $evals = $c->stash->{build}->jobsetevals; + + $c->stash->{page} = $page; + $c->stash->{resultsPerPage} = $resultsPerPage; + $c->stash->{total} = $evals->search({hasnewbuilds => 1})->count; + $c->stash->{evals} = getEvals($self, $c, $evals, ($page - 1) * $resultsPerPage, $resultsPerPage) +} + + 1; diff --git a/src/root/build.tt b/src/root/build.tt index 5c104321..abf6684b 100644 --- a/src/root/build.tt +++ b/src/root/build.tt @@ -112,7 +112,7 @@ Part of: evaluation [% eval.id %] - [% IF nrEvals > 1 +%] (and [% nrEvals - 1 %] others)[% END %] + [% IF nrEvals > 1 +%] (and [% nrEvals - 1 %] others)[% END %] [% END %] diff --git a/src/root/common.tt b/src/root/common.tt index 77bddbf5..fe70e713 100644 --- a/src/root/common.tt +++ b/src/root/common.tt @@ -384,7 +384,7 @@ BLOCK renderEvals %] - [% IF !jobset %] + [% IF !jobset && !build %] [% END %] @@ -398,7 +398,7 @@ BLOCK renderEvals %] eval = e.eval; link = c.uri_for(c.controller('JobsetEval').action_for('view'), [eval.id]) %] - [% IF !jobset %] + [% IF !jobset && !build %] [% END %] diff --git a/src/root/evals.tt b/src/root/evals.tt index 5d2ff6ba..ae42e833 100644 --- a/src/root/evals.tt +++ b/src/root/evals.tt @@ -1,4 +1,7 @@ -[% WRAPPER layout.tt title=(jobset ? "Evaluations of jobset $project.name:$jobset.name" : "Latest evaluations") %] +[% WRAPPER layout.tt title= + (build ? "Evaluations containing build $build.id" : + jobset ? "Evaluations of jobset $project.name:$jobset.name" : + "Latest evaluations") %] [% PROCESS common.tt %]

Showing evaluations [% (page - 1) * resultsPerPage + 1 %] - [%

Jobset#
[% INCLUDE renderFullJobsetName project=eval.get_column('project') jobset=eval.get_column('jobset') %][% eval.id %]