From 9f7403765cb6e7f54a400506c7e02f1694152159 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 28 Oct 2008 12:44:36 +0000 Subject: [PATCH] * Show the latest build for each job. --- .../lib/HydraFrontend/Controller/Root.pm | 7 +++-- src/HydraFrontend/root/index.tt | 29 +++++++++---------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/HydraFrontend/lib/HydraFrontend/Controller/Root.pm b/src/HydraFrontend/lib/HydraFrontend/Controller/Root.pm index c712a696..f000cbf9 100644 --- a/src/HydraFrontend/lib/HydraFrontend/Controller/Root.pm +++ b/src/HydraFrontend/lib/HydraFrontend/Controller/Root.pm @@ -29,7 +29,10 @@ sub getBuild { sub index :Path :Args(0) { my ( $self, $c ) = @_; $c->stash->{template} = 'index.tt'; - $c->stash->{builds} = [$c->model('DB::Builds')->all]; + $c->stash->{allBuilds} = [$c->model('DB::Builds')->all]; + # Get the latest build for each unique job. + # select * from builds as x where timestamp == (select max(timestamp) from builds where name == x.name); + $c->stash->{latestBuilds} = [$c->model('DB::Builds')->search(undef, {order_by => "name", where => "timestamp == (select max(timestamp) from builds where name == me.name)"})]; } @@ -44,7 +47,7 @@ sub build :Local { my $build = getBuild($c, $id); return error($c, "Build with ID $id doesn't exist.") if !defined $build; - + $c->stash->{template} = 'build.tt'; $c->stash->{build} = $build; $c->stash->{id} = $id; diff --git a/src/HydraFrontend/root/index.tt b/src/HydraFrontend/root/index.tt index 47266085..d9286c96 100644 --- a/src/HydraFrontend/root/index.tt +++ b/src/HydraFrontend/root/index.tt @@ -1,24 +1,23 @@ [% WRAPPER layout.tt title="Hydra Overview" %] [% USE date %] -

All builds

+

Job status

- [% FOREACH build IN builds -%] - - - - - - - + [% FOREACH build IN latestBuilds -%] + [% INCLUDE "short-build-info.tt" %] + [% END -%] +
IdAttribute nameTimestampDescription
- [% IF build.buildstatus == 0 %] - - [% ELSE %] - - [% END %] - [% build.id %][% build.name %][% date.format(build.timestamp, '%Y-%m-%d %H:%M:%S') %][% build.description %]
+ +

All builds

+ +

Number of builds: [% allBuilds.size %]

+ + + + [% FOREACH build IN allBuilds -%] + [% INCLUDE "short-build-info.tt" %] [% END -%]
IdAttribute nameTimestampDescription