diff --git a/src/Hydra/lib/Hydra/Controller/Root.pm b/src/Hydra/lib/Hydra/Controller/Root.pm index 8a13a14c..9b51757e 100644 --- a/src/Hydra/lib/Hydra/Controller/Root.pm +++ b/src/Hydra/lib/Hydra/Controller/Root.pm @@ -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) = @_; diff --git a/src/Hydra/root/all.tt b/src/Hydra/root/all.tt new file mode 100644 index 00000000..f095fc59 --- /dev/null +++ b/src/Hydra/root/all.tt @@ -0,0 +1,20 @@ +[% WRAPPER layout.tt title="All Builds" %] +[% PROCESS common.tt %] + +

All Builds

+ +

Showing builds [% (page - 1) * resultsPerPage + 1 %] - [% (page - 1) * resultsPerPage + builds.size %] +out of [% totalBuilds %] in order of descending timestamp.

+ +[% PROCESS renderBuildList %] + +[First] +[% IF page > 1 %] + [Prev] +[% END %] +[% IF page * resultsPerPage < totalBuilds %] + [Next] +[% END %] +[Last] + +[% END %] diff --git a/src/Hydra/root/build.tt b/src/Hydra/root/build.tt index 7f13a438..a3ecd4c9 100644 --- a/src/Hydra/root/build.tt +++ b/src/Hydra/root/build.tt @@ -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") %] diff --git a/src/Hydra/root/error.tt b/src/Hydra/root/error.tt index 01f7ac95..63b858f7 100644 --- a/src/Hydra/root/error.tt +++ b/src/Hydra/root/error.tt @@ -1,4 +1,4 @@ -[% WRAPPER layout.tt title="Hydra Overview" %] +[% WRAPPER layout.tt title="Error" %] [% USE HTML %]

Error

diff --git a/src/Hydra/root/index.tt b/src/Hydra/root/index.tt index 543e4d69..44ff308e 100644 --- a/src/Hydra/root/index.tt +++ b/src/Hydra/root/index.tt @@ -1,4 +1,4 @@ -[% WRAPPER layout.tt title="Hydra Overview" %] +[% WRAPPER layout.tt title="Overview" %] [% PROCESS common.tt %] @@ -10,18 +10,4 @@ [% PROCESS showBuildStats %] -

Job status

- -

Below are the latest builds for each job.

- -[% PROCESS renderBuildList builds=latestBuilds %] - - -

All builds

- -

Number of builds: [% allBuilds.size %]

- -[% PROCESS renderBuildList builds=allBuilds %] - - [% END %] diff --git a/src/Hydra/root/job.tt b/src/Hydra/root/job.tt index 7103bffd..b584c847 100644 --- a/src/Hydra/root/job.tt +++ b/src/Hydra/root/job.tt @@ -1,4 +1,4 @@ -[% WRAPPER layout.tt title="Hydra Overview" %] +[% WRAPPER layout.tt title="Job ‘$curProject.name:$jobName’" %] [% PROCESS common.tt %]

All builds for job [% curProject.name %]:[% jobName %]

diff --git a/src/Hydra/root/jobstatus.tt b/src/Hydra/root/jobstatus.tt new file mode 100644 index 00000000..1667b333 --- /dev/null +++ b/src/Hydra/root/jobstatus.tt @@ -0,0 +1,10 @@ +[% WRAPPER layout.tt title="Job Status" %] +[% PROCESS common.tt %] + +

Job Status

+ +

Below are the latest builds for each job.

+ +[% PROCESS renderBuildList builds=latestBuilds %] + +[% END %] diff --git a/src/Hydra/root/layout.tt b/src/Hydra/root/layout.tt index 94bac755..863370aa 100644 --- a/src/Hydra/root/layout.tt +++ b/src/Hydra/root/layout.tt @@ -13,7 +13,7 @@ - [% title %] + Hydra - [% title %] @@ -82,6 +82,7 @@