2009-03-04 10:59:14 +00:00
|
|
|
package Hydra::Base::Controller::ListBuilds;
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
2009-03-04 16:36:23 +00:00
|
|
|
use base 'Hydra::Base::Controller::NixChannel';
|
2009-03-04 10:59:14 +00:00
|
|
|
use Hydra::Helper::Nix;
|
|
|
|
use Hydra::Helper::CatalystUtils;
|
|
|
|
|
|
|
|
|
|
|
|
sub jobstatus : Chained('get_builds') PathPart Args(0) {
|
|
|
|
my ($self, $c) = @_;
|
2009-03-04 17:24:08 +00:00
|
|
|
$c->stash->{template} = 'jobstatus.tt';
|
2009-03-13 17:32:08 +00:00
|
|
|
$c->stash->{latestBuilds} =
|
2009-04-03 15:37:21 +00:00
|
|
|
[joinWithResultInfo($c, $c->stash->{jobStatus})->all];
|
2009-03-04 10:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sub all : Chained('get_builds') PathPart {
|
|
|
|
my ($self, $c, $page) = @_;
|
|
|
|
|
|
|
|
$c->stash->{template} = 'all.tt';
|
|
|
|
|
|
|
|
$page = (defined $page ? int($page) : 1) || 1;
|
|
|
|
|
|
|
|
my $resultsPerPage = 50;
|
|
|
|
|
|
|
|
my $nrBuilds = scalar($c->stash->{allBuilds}->search({finished => 1}));
|
|
|
|
|
|
|
|
$c->stash->{baseUri} = $c->uri_for($self->action_for("all"), $c->req->captures);
|
|
|
|
|
|
|
|
$c->stash->{page} = $page;
|
|
|
|
$c->stash->{resultsPerPage} = $resultsPerPage;
|
|
|
|
$c->stash->{totalBuilds} = $nrBuilds;
|
|
|
|
|
2009-04-03 15:37:21 +00:00
|
|
|
$c->stash->{builds} = [joinWithResultInfo($c, $c->stash->{allBuilds})->search(
|
2009-03-23 13:52:24 +00:00
|
|
|
{ finished => 1 },
|
2009-04-03 15:37:21 +00:00
|
|
|
{ order_by => "timestamp DESC"
|
2009-03-23 13:52:24 +00:00
|
|
|
, rows => $resultsPerPage
|
|
|
|
, page => $page })];
|
2009-03-04 10:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-03-04 16:36:23 +00:00
|
|
|
sub nix : Chained('get_builds') PathPart('channel') CaptureArgs(1) {
|
|
|
|
my ($self, $c, $channelName) = @_;
|
|
|
|
eval {
|
|
|
|
if ($channelName eq "latest") {
|
|
|
|
$c->stash->{channelName} = $c->stash->{channelBaseName} . "-latest";
|
2009-04-03 15:37:21 +00:00
|
|
|
getChannelData($c, scalar($c->stash->{latestSucceeded}));
|
2009-03-04 16:36:23 +00:00
|
|
|
}
|
|
|
|
elsif ($channelName eq "all") {
|
|
|
|
$c->stash->{channelName} = $c->stash->{channelBaseName} . "-all";
|
2009-04-03 15:37:21 +00:00
|
|
|
getChannelData($c, scalar($c->stash->{allBuilds}));
|
2009-03-04 16:36:23 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
error($c, "Unknown channel `$channelName'.");
|
|
|
|
}
|
|
|
|
};
|
|
|
|
error($c, $@) if $@;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-03-04 10:59:14 +00:00
|
|
|
1;
|