* Unify rendering of finished and scheduled builds.
This commit is contained in:
parent
b7e03351cb
commit
fa042e04ae
|
@ -18,7 +18,7 @@ my $relPathRE = "(?:$pathCompRE(?:\/$pathCompRE)*)";
|
|||
|
||||
|
||||
sub begin :Private {
|
||||
my ( $self, $c ) = @_;
|
||||
my ($self, $c) = @_;
|
||||
$c->stash->{projects} = [$c->model('DB::Projects')->search({}, {order_by => 'displayname'})];
|
||||
$c->stash->{curUri} = $c->request->uri;
|
||||
}
|
||||
|
@ -47,10 +47,8 @@ sub getBuild {
|
|||
|
||||
|
||||
sub index :Path :Args(0) {
|
||||
my ( $self, $c ) = @_;
|
||||
my ($self, $c) = @_;
|
||||
$c->stash->{template} = 'index.tt';
|
||||
$c->stash->{scheduled} = [$c->model('DB::Builds')->search(
|
||||
{finished => 0}, {join => 'schedulingInfo'})]; # !!!
|
||||
$c->stash->{allBuilds} = [$c->model('DB::Builds')->search(
|
||||
{finished => 1}, {order_by => "timestamp DESC"})];
|
||||
# Get the latest finished build for each unique job.
|
||||
|
@ -63,6 +61,14 @@ sub index :Path :Args(0) {
|
|||
}
|
||||
|
||||
|
||||
sub queue :Local {
|
||||
my ($self, $c) = @_;
|
||||
$c->stash->{template} = 'queue.tt';
|
||||
$c->stash->{queue} = [$c->model('DB::Builds')->search(
|
||||
{finished => 0}, {join => 'schedulingInfo', order_by => ["priority DESC", "timestamp"]})];
|
||||
}
|
||||
|
||||
|
||||
sub updateProject {
|
||||
my ($c, $project) = @_;
|
||||
|
||||
|
@ -184,7 +190,7 @@ sub updateProject {
|
|||
|
||||
|
||||
sub project :Local {
|
||||
my ( $self, $c, $projectName, $subcommand ) = @_;
|
||||
my ($self, $c, $projectName, $subcommand) = @_;
|
||||
$c->stash->{template} = 'project.tt';
|
||||
|
||||
(my $project) = $c->model('DB::Projects')->search({ name => $projectName });
|
||||
|
@ -239,7 +245,7 @@ sub project :Local {
|
|||
|
||||
|
||||
sub createproject :Local {
|
||||
my ( $self, $c, $subcommand ) = @_;
|
||||
my ($self, $c, $subcommand) = @_;
|
||||
|
||||
if (defined $subcommand && $subcommand eq "submit") {
|
||||
eval {
|
||||
|
@ -265,7 +271,7 @@ sub createproject :Local {
|
|||
|
||||
|
||||
sub job :Local {
|
||||
my ( $self, $c, $projectName, $jobName ) = @_;
|
||||
my ($self, $c, $projectName, $jobName) = @_;
|
||||
$c->stash->{template} = 'job.tt';
|
||||
|
||||
(my $project) = $c->model('DB::Projects')->search({ name => $projectName });
|
||||
|
@ -280,13 +286,13 @@ sub job :Local {
|
|||
|
||||
|
||||
sub default :Path {
|
||||
my ( $self, $c ) = @_;
|
||||
my ($self, $c) = @_;
|
||||
error($c, "Page not found.");
|
||||
}
|
||||
|
||||
|
||||
sub build :Local {
|
||||
my ( $self, $c, $id ) = @_;
|
||||
my ($self, $c, $id) = @_;
|
||||
|
||||
my $build = getBuild($c, $id);
|
||||
return error($c, "Build with ID $id doesn't exist.") if !defined $build;
|
||||
|
@ -307,7 +313,7 @@ sub build :Local {
|
|||
|
||||
|
||||
sub log :Local {
|
||||
my ( $self, $c, $id ) = @_;
|
||||
my ($self, $c, $id) = @_;
|
||||
|
||||
my $build = getBuild($c, $id);
|
||||
return error($c, "Build $id doesn't exist.") if !defined $build;
|
||||
|
@ -323,7 +329,7 @@ sub log :Local {
|
|||
|
||||
|
||||
sub nixlog :Local {
|
||||
my ( $self, $c, $id, $stepnr ) = @_;
|
||||
my ($self, $c, $id, $stepnr) = @_;
|
||||
|
||||
my $build = getBuild($c, $id);
|
||||
return error($c, "Build with ID $id doesn't exist.") if !defined $build;
|
||||
|
@ -356,7 +362,7 @@ sub loadLog {
|
|||
|
||||
|
||||
sub download :Local {
|
||||
my ( $self, $c, $id, $productnr, $filename, @path ) = @_;
|
||||
my ($self, $c, $id, $productnr, $filename, @path) = @_;
|
||||
|
||||
my $build = getBuild($c, $id);
|
||||
return error($c, "Build with ID $id doesn't exist.") if !defined $build;
|
||||
|
@ -390,7 +396,7 @@ sub download :Local {
|
|||
|
||||
|
||||
sub closure :Local {
|
||||
my ( $self, $c, $buildId, $productnr ) = @_;
|
||||
my ($self, $c, $buildId, $productnr) = @_;
|
||||
|
||||
my $build = getBuild($c, $buildId);
|
||||
return error($c, "Build with ID $buildId doesn't exist.") if !defined $build;
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
[% USE date %]
|
||||
|
||||
|
||||
[% inputTypes =
|
||||
{ "svn" = "Subversion checkout"
|
||||
, "cvs" = "CVS checkout"
|
||||
|
@ -9,8 +12,53 @@
|
|||
}
|
||||
%]
|
||||
|
||||
[% USE date %]
|
||||
|
||||
[% BLOCK renderDateTime %]
|
||||
[% date.format(timestamp, '%Y-%m-%d %H:%M:%S') -%]
|
||||
[% END %]
|
||||
|
||||
|
||||
[% BLOCK renderBuildList %]
|
||||
<table class="tablesorter">
|
||||
<thead>
|
||||
<tr>
|
||||
[% IF !hideResultInfo %]
|
||||
<th></th>
|
||||
[% END %]
|
||||
<th>#</th>
|
||||
[% IF showSchedulingInfo %]
|
||||
<th>Priority</th>
|
||||
[% END %]
|
||||
<th>Project</th>
|
||||
<th>Job</th>
|
||||
<th>System</th>
|
||||
<th>Timestamp</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
[% FOREACH build IN builds -%]
|
||||
<tr [% IF build.schedulingInfo.busy %]class="runningJob"[% END %] >
|
||||
[% IF !hideResultInfo %]
|
||||
<td>
|
||||
[% IF build.resultInfo.buildstatus == 0 %]
|
||||
<img src="/static/images/success.gif" />
|
||||
[% ELSE %]
|
||||
<img src="/static/images/failure.gif" />
|
||||
[% END %]
|
||||
</td>
|
||||
[% END %]
|
||||
<td><a href="[% c.uri_for('/build' build.id) %]">[% build.id %]</a></td>
|
||||
[% IF showSchedulingInfo %]
|
||||
<td>[% build.schedulingInfo.priority %]</td>
|
||||
[% END %]
|
||||
<td><a href="[% c.uri_for('/project' build.project.name) %]"><tt>[% build.project.name %]</tt></a></td>
|
||||
<td><a href="[% c.uri_for('/job' build.project.name build.attrname) %]"><tt>[% build.attrname %]</tt></a></td>
|
||||
<td><tt>[% build.system %]</tt></td>
|
||||
<td>[% date.format(build.timestamp, '%Y-%m-%d %H:%M:%S') %]</td>
|
||||
<td>[% build.description %]</td>
|
||||
</tr>
|
||||
[% END -%]
|
||||
</tbody>
|
||||
</table>
|
||||
[% END %]
|
|
@ -1,70 +1,22 @@
|
|||
[% WRAPPER layout.tt title="Hydra Overview" %]
|
||||
[% USE date %]
|
||||
[% PROCESS common.tt %]
|
||||
|
||||
|
||||
<h1>Hydra Overview</h1>
|
||||
|
||||
|
||||
<h2>Queue</h2>
|
||||
|
||||
[% IF scheduled.size == 0 %]
|
||||
|
||||
<p>The queue is empty.</p>
|
||||
|
||||
[% ELSE %]
|
||||
|
||||
<table class="tablesorter">
|
||||
<thead>
|
||||
<tr><th>#</th><th>Priority</th><th>Project</th><th>Job</th><th>System</th><th>Timestamp</th><th>Description</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
[% FOREACH build IN scheduled -%]
|
||||
<tr [% IF build.schedulingInfo.busy %]class="runningJob"[% END %] >
|
||||
<td><a href="[% c.uri_for('/build' build.id) %]">[% build.id %]</a></td>
|
||||
<td>[% build.schedulingInfo.priority %]</td>
|
||||
<td><tt>[% build.project.name %]</tt></td>
|
||||
<td><tt>[% build.attrname %]</tt></td>
|
||||
<td><tt>[% build.system %]</tt></td>
|
||||
<td>[% date.format(build.timestamp, '%Y-%m-%d %H:%M:%S') %]</td>
|
||||
<td>[% build.description %]</td>
|
||||
</tr>
|
||||
[% END -%]
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
[% END %]
|
||||
|
||||
|
||||
<h2>Job status</h2>
|
||||
|
||||
<p>Below are the latest builds for each job.</p>
|
||||
|
||||
<table class="tablesorter">
|
||||
<thead>
|
||||
<tr><th></th><th>#</th><th>Project</th><th>Job</th><th>System</th><th>Timestamp</th><th>Description</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
[% FOREACH build IN latestBuilds -%]
|
||||
[% INCLUDE "short-build-info.tt" %]
|
||||
[% END -%]
|
||||
</tbody>
|
||||
</table>
|
||||
[% PROCESS renderBuildList builds=latestBuilds %]
|
||||
|
||||
|
||||
<h2>All builds</h2>
|
||||
|
||||
<p>Number of builds: [% allBuilds.size %]</p>
|
||||
|
||||
<table class="tablesorter">
|
||||
<thead>
|
||||
<tr><th></th><th>#</th><th>Project</th><th>Job</th><th>System</th><th>Timestamp</th><th>Description</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
[% FOREACH build IN allBuilds -%]
|
||||
[% INCLUDE "short-build-info.tt" %]
|
||||
[% END -%]
|
||||
</tbody>
|
||||
</table>
|
||||
[% PROCESS renderBuildList builds=allBuilds %]
|
||||
|
||||
|
||||
[% END %]
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
[% WRAPPER layout.tt title="Hydra Overview" %]
|
||||
[% PROCESS common.tt %]
|
||||
|
||||
<h1>All builds for job <tt>[% curProject.name %]:[% jobName %]</tt></h1>
|
||||
|
||||
<table class="tablesorter">
|
||||
<thead>
|
||||
<tr><th></th><th>Id</th><th>Project</th><th>Job</th><th>System</th><th>Timestamp</th><th>Description</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
[% FOREACH build IN builds -%]
|
||||
[% INCLUDE "short-build-info.tt" %]
|
||||
[% END -%]
|
||||
</tbody>
|
||||
</table>
|
||||
[% PROCESS renderBuildList builds=builds %]
|
||||
|
||||
[% END %]
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
[% USE date %]
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
[% IF build.resultInfo.buildstatus == 0 %]
|
||||
<img src="/static/images/success.gif" />
|
||||
[% ELSE %]
|
||||
<img src="/static/images/failure.gif" />
|
||||
[% END %]
|
||||
</td>
|
||||
<td><a href="[% c.uri_for('/build' build.id) %]">[% build.id %]</a></td>
|
||||
<td><a href="[% c.uri_for('/project' build.project.name) %]"><tt>[% build.project.name %]</tt></a></td>
|
||||
<td><a href="[% c.uri_for('/job' build.project.name build.attrname) %]"><tt>[% build.attrname %]</tt></a></td>
|
||||
<td><tt>[% build.system %]</tt></td>
|
||||
<td>[% date.format(build.timestamp, '%Y-%m-%d %H:%M:%S') %]</td>
|
||||
<td>[% build.description %]</td>
|
||||
</tr>
|
|
@ -185,7 +185,7 @@ ul.productList li {
|
|||
margin-top: 1em;
|
||||
}
|
||||
|
||||
tr.runningJob {
|
||||
.runningJob {
|
||||
background-color: #ff3030;
|
||||
color: white;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue