forked from lix-project/hydra
* Show the latest build for each job.
This commit is contained in:
parent
7ded8bbd15
commit
9f7403765c
|
@ -29,7 +29,10 @@ sub getBuild {
|
||||||
sub index :Path :Args(0) {
|
sub index :Path :Args(0) {
|
||||||
my ( $self, $c ) = @_;
|
my ( $self, $c ) = @_;
|
||||||
$c->stash->{template} = 'index.tt';
|
$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);
|
my $build = getBuild($c, $id);
|
||||||
return error($c, "Build with ID $id doesn't exist.") if !defined $build;
|
return error($c, "Build with ID $id doesn't exist.") if !defined $build;
|
||||||
|
|
||||||
$c->stash->{template} = 'build.tt';
|
$c->stash->{template} = 'build.tt';
|
||||||
$c->stash->{build} = $build;
|
$c->stash->{build} = $build;
|
||||||
$c->stash->{id} = $id;
|
$c->stash->{id} = $id;
|
||||||
|
|
|
@ -1,24 +1,23 @@
|
||||||
[% WRAPPER layout.tt title="Hydra Overview" %]
|
[% WRAPPER layout.tt title="Hydra Overview" %]
|
||||||
[% USE date %]
|
[% USE date %]
|
||||||
|
|
||||||
<h1>All builds</h1>
|
<h1>Job status</h1>
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr><th></th><th>Id</th><th>Attribute name</th><th>Timestamp</th><th>Description</th></tr>
|
<tr><th></th><th>Id</th><th>Attribute name</th><th>Timestamp</th><th>Description</th></tr>
|
||||||
[% FOREACH build IN builds -%]
|
[% FOREACH build IN latestBuilds -%]
|
||||||
<tr>
|
[% INCLUDE "short-build-info.tt" %]
|
||||||
<td>
|
[% END -%]
|
||||||
[% IF build.buildstatus == 0 %]
|
</table>
|
||||||
<img src="static/images/success.gif" />
|
|
||||||
[% ELSE %]
|
<h1>All builds</h1>
|
||||||
<img src="static/images/failure.gif" />
|
|
||||||
[% END %]
|
<p>Number of builds: [% allBuilds.size %]</p>
|
||||||
</td>
|
|
||||||
<td><a href="[% c.uri_for('/build' build.id) %]">[% build.id %]</a></td>
|
<table>
|
||||||
<td>[% build.name %]</td>
|
<tr><th></th><th>Id</th><th>Attribute name</th><th>Timestamp</th><th>Description</th></tr>
|
||||||
<td>[% date.format(build.timestamp, '%Y-%m-%d %H:%M:%S') %]</td>
|
[% FOREACH build IN allBuilds -%]
|
||||||
<td>[% build.description %]</td>
|
[% INCLUDE "short-build-info.tt" %]
|
||||||
</tr>
|
|
||||||
[% END -%]
|
[% END -%]
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue