From d6bd9bab5f0725a711cbb48082127bfb70cc6ff0 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 15 Apr 2009 14:50:15 +0000 Subject: [PATCH] * Job status / error pages: show only active jobs. --- src/lib/Hydra/Base/Controller/ListBuilds.pm | 22 ++++++++++++++++++--- src/lib/Hydra/Controller/Job.pm | 1 + 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/lib/Hydra/Base/Controller/ListBuilds.pm b/src/lib/Hydra/Base/Controller/ListBuilds.pm index c72e38a3..3426a1d6 100644 --- a/src/lib/Hydra/Base/Controller/ListBuilds.pm +++ b/src/lib/Hydra/Base/Controller/ListBuilds.pm @@ -7,11 +7,27 @@ use Hydra::Helper::Nix; 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) { my ($self, $c) = @_; $c->stash->{template} = 'jobstatus.tt'; - $c->stash->{latestBuilds} = - [joinWithResultInfo($c, $c->stash->{jobStatus})->all]; + $c->stash->{latestBuilds} = [getJobStatus($self, $c)->all]; } @@ -27,7 +43,7 @@ sub errors : Chained('get_builds') PathPart Args(0) { [$c->stash->{allJobs}->search({errormsg => {'!=' => ''}})] if defined $c->stash->{allJobs}; $c->stash->{brokenBuilds} = - [joinWithResultInfo($c, $c->stash->{jobStatus})->search({buildstatus => {'!=' => 0}})]; + [getJobStatus($self, $c)->search({buildstatus => {'!=' => 0}})]; } diff --git a/src/lib/Hydra/Controller/Job.pm b/src/lib/Hydra/Controller/Job.pm index 7f2052d7..e387bf8c 100644 --- a/src/lib/Hydra/Controller/Job.pm +++ b/src/lib/Hydra/Controller/Job.pm @@ -15,6 +15,7 @@ sub job : Chained('/') PathPart('job') CaptureArgs(3) { or notFound($c, "Job $projectName:$jobsetName:$jobName doesn't exist."); $c->stash->{project} = $c->stash->{job}->project; $c->stash->{jobset} = $c->stash->{job}->jobset; + $c->stash->{showInactiveJobs} = 1; }