* Job status / error pages: show only active jobs.

This commit is contained in:
Eelco Dolstra 2009-04-15 14:50:15 +00:00
parent 2a05522189
commit d6bd9bab5f
2 changed files with 20 additions and 3 deletions

View file

@ -7,11 +7,27 @@ use Hydra::Helper::Nix;
use Hydra::Helper::CatalystUtils; use Hydra::Helper::CatalystUtils;
sub getJobStatus {
my ($self, $c) = @_;
my $latest = joinWithResultInfo($c, $c->stash->{jobStatus});
$latest = $latest->search(
{ active => 1 },
{ join => 'job'
, '+select' => ["job.active"]
, '+as' => ["active"]
})
unless defined $c->stash->{showInactiveJobs};
return $latest;
}
sub jobstatus : Chained('get_builds') PathPart Args(0) { sub jobstatus : Chained('get_builds') PathPart Args(0) {
my ($self, $c) = @_; my ($self, $c) = @_;
$c->stash->{template} = 'jobstatus.tt'; $c->stash->{template} = 'jobstatus.tt';
$c->stash->{latestBuilds} = $c->stash->{latestBuilds} = [getJobStatus($self, $c)->all];
[joinWithResultInfo($c, $c->stash->{jobStatus})->all];
} }
@ -27,7 +43,7 @@ sub errors : Chained('get_builds') PathPart Args(0) {
[$c->stash->{allJobs}->search({errormsg => {'!=' => ''}})] [$c->stash->{allJobs}->search({errormsg => {'!=' => ''}})]
if defined $c->stash->{allJobs}; if defined $c->stash->{allJobs};
$c->stash->{brokenBuilds} = $c->stash->{brokenBuilds} =
[joinWithResultInfo($c, $c->stash->{jobStatus})->search({buildstatus => {'!=' => 0}})]; [getJobStatus($self, $c)->search({buildstatus => {'!=' => 0}})];
} }

View file

@ -15,6 +15,7 @@ sub job : Chained('/') PathPart('job') CaptureArgs(3) {
or notFound($c, "Job $projectName:$jobsetName:$jobName doesn't exist."); or notFound($c, "Job $projectName:$jobsetName:$jobName doesn't exist.");
$c->stash->{project} = $c->stash->{job}->project; $c->stash->{project} = $c->stash->{job}->project;
$c->stash->{jobset} = $c->stash->{job}->jobset; $c->stash->{jobset} = $c->stash->{job}->jobset;
$c->stash->{showInactiveJobs} = 1;
} }