* Separate job status and all builds pages.

This commit is contained in:
Eelco Dolstra 2008-11-27 00:38:09 +00:00
parent 38a1b0d7ef
commit 266aa141bd
11 changed files with 81 additions and 61 deletions

View file

@ -72,17 +72,6 @@ sub index :Path :Args(0) {
$c->stash->{template} = 'index.tt';
getBuildStats($c, $c->model('DB::Builds'));
$c->stash->{allBuilds} = [$c->model('DB::Builds')->search(
{finished => 1}, {order_by => "timestamp DESC"})];
# Get the latest finished build for each unique job.
$c->stash->{latestBuilds} = [$c->model('DB::Builds')->search(undef,
{ join => 'resultInfo'
, where => "finished != 0 and timestamp = (select max(timestamp) from Builds " .
"where project == me.project and attrName == me.attrName and finished != 0 and system == me.system)"
, order_by => "project, attrname, system"
})];
}
@ -129,6 +118,39 @@ sub queue :Local {
}
sub jobstatus :Local {
my ($self, $c) = @_;
$c->stash->{template} = 'jobstatus.tt';
# Get the latest finished build for each unique job.
$c->stash->{latestBuilds} = [$c->model('DB::Builds')->search(undef,
{ join => 'resultInfo'
, where => "finished != 0 and timestamp = (select max(timestamp) from Builds " .
"where project == me.project and attrName == me.attrName and finished != 0 and system == me.system)"
, order_by => "project, attrname, system"
})];
}
sub all :Local {
my ($self, $c, $page) = @_;
$c->stash->{template} = 'all.tt';
$page = int($page) || 1;
my $resultsPerPage = 50;
my $nrBuilds = scalar($c->model('DB::Builds')->search({finished => 1}));
$c->stash->{page} = $page;
$c->stash->{resultsPerPage} = $resultsPerPage;
$c->stash->{totalBuilds} = $nrBuilds;
$c->stash->{builds} = [$c->model('DB::Builds')->search(
{finished => 1}, {order_by => "timestamp DESC", rows => $resultsPerPage, page => $page})];
}
sub updateProject {
my ($c, $project) = @_;

20
src/Hydra/root/all.tt Normal file
View file

@ -0,0 +1,20 @@
[% WRAPPER layout.tt title="All Builds" %]
[% PROCESS common.tt %]
<h1>All Builds</h1>
<p>Showing builds [% (page - 1) * resultsPerPage + 1 %] - [% (page - 1) * resultsPerPage + builds.size %]
out of [% totalBuilds %] in order of descending timestamp.</p>
[% PROCESS renderBuildList %]
[<a href="[% c.uri_for('/all' 1) %]">First</a>]
[% IF page > 1 %]
[<a href="[% c.uri_for('/all' (page - 1)) %]">Prev</a>]
[% END %]
[% IF page * resultsPerPage < totalBuilds %]
[<a href="[% c.uri_for('/all' (page + 1)) %]">Next</a>]
[% END %]
[<a href="[% c.uri_for('/all' (totalBuilds - 1) div resultsPerPage + 1) %]">Last</a>]
[% END %]

View file

@ -1,4 +1,4 @@
[% WRAPPER layout.tt title="Hydra Overview" %]
[% WRAPPER layout.tt title="Build Information" %]
[% PROCESS common.tt %]
[% USE HTML %]
[% USE mibs=format("%.2f") %]

View file

@ -1,4 +1,4 @@
[% WRAPPER layout.tt title="Hydra Overview" %]
[% WRAPPER layout.tt title="Error" %]
[% USE HTML %]
<h1>Error</h1>

View file

@ -1,4 +1,4 @@
[% WRAPPER layout.tt title="Hydra Overview" %]
[% WRAPPER layout.tt title="Overview" %]
[% PROCESS common.tt %]
@ -10,18 +10,4 @@
[% PROCESS showBuildStats %]
<h2>Job status</h2>
<p>Below are the latest builds for each job.</p>
[% PROCESS renderBuildList builds=latestBuilds %]
<h2>All builds</h2>
<p>Number of builds: [% allBuilds.size %]</p>
[% PROCESS renderBuildList builds=allBuilds %]
[% END %]

View file

@ -1,4 +1,4 @@
[% WRAPPER layout.tt title="Hydra Overview" %]
[% WRAPPER layout.tt title="Job $curProject.name:$jobName" %]
[% PROCESS common.tt %]
<h1>All builds for job <tt>[% curProject.name %]:[% jobName %]</tt></h1>

View file

@ -0,0 +1,10 @@
[% WRAPPER layout.tt title="Job Status" %]
[% PROCESS common.tt %]
<h1>Job Status</h1>
<p>Below are the latest builds for each job.</p>
[% PROCESS renderBuildList builds=latestBuilds %]
[% END %]

View file

@ -13,7 +13,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>[% title %]</title>
<title>Hydra - [% title %]</title>
<link rel="stylesheet" href="/static/css/hydra.css" type="text/css" />
<link rel="stylesheet" href="/static/css/logfile.css" type="text/css" />
<script type="text/javascript" src="/static/js/jquery-pack.js"></script>
@ -82,6 +82,7 @@
<ul class="submenu">
[% INCLUDE makeLink uri = c.uri_for('/') title = "Overview" %]
[% INCLUDE makeLink uri = c.uri_for('/queue') title = "Queue" %]
[% INCLUDE makeLink uri = c.uri_for('/jobstatus') title = "Job status" %]
[% INCLUDE makeLink uri = c.uri_for('/latest') title = "Latest builds" %]
[% INCLUDE makeLink uri = c.uri_for('/all') title = "All builds" %]
[% INCLUDE makeLink uri = c.uri_for('/search') title = "Search builds" %]

View file

@ -1,4 +1,4 @@
[% WRAPPER layout.tt title="Hydra Overview" %]
[% WRAPPER layout.tt title="Logfile" %]
<h1>Logfile for <tt>[% build.project.name %]:[% build.attrname %]</tt> build [% build.id %][%IF step %], step [% step.stepnr %] (<tt>[% step.outpath %]</tt>)[% END %]</h1>

View file

@ -1,4 +1,4 @@
[% WRAPPER layout.tt title="Hydra Overview" %]
[% WRAPPER layout.tt title=(edit ? (create ? "New Project" : "Editing Project $curProject.name") : "Project $curProject.name") %]
[% PROCESS common.tt %]
[% USE HTML %]
@ -176,6 +176,15 @@
</table>
[% IF !edit %]
<h2>Statistics</h2>
[% PROCESS showBuildStats %]
[% END %]
<h2>Jobsets</h2>
[% IF curProject.jobsets && curProject.jobsets.size > 0 || edit %]
@ -240,34 +249,6 @@
[% END %]
[% IF !edit %]
<h2>Jobs</h2>
[% IF jobNames && jobNames.size > 0 %]
<ul>
[% FOREACH jobName IN jobNames -%]
<li><a href="[% c.uri_for('/job' curProject.name jobName.attrname) %]"><tt>[% jobName.attrname %]</tt></a></li>
[% END %]
</ul>
[% ELSE %]
<p>No builds have been performed or scheduled.</p>
[% END %]
<h2>Statistics</h2>
[% PROCESS showBuildStats %]
[% END %]
[% IF edit %]
<hr />

View file

@ -1,4 +1,4 @@
[% WRAPPER layout.tt title="Hydra Queue" %]
[% WRAPPER layout.tt title="Queue" %]
[% PROCESS common.tt %]
<h1>Hydra Queue</h1>