* Controller for jobs which inherits all actions in ListBuilds. So

for instance we get channels specific for each job.
This commit is contained in:
Eelco Dolstra 2009-03-04 17:24:08 +00:00
parent 5162f05e2c
commit 0bd7abf10b
7 changed files with 41 additions and 26 deletions

View file

@ -9,6 +9,7 @@ use Hydra::Helper::CatalystUtils;
sub jobstatus : Chained('get_builds') PathPart Args(0) {
my ($self, $c) = @_;
$c->stash->{template} = 'jobstatus.tt';
$c->stash->{latestBuilds} = getLatestBuilds($c, $c->stash->{allBuilds}, {});
}

View file

@ -0,0 +1,35 @@
package Hydra::Controller::Job;
use strict;
use warnings;
use base 'Hydra::Base::Controller::ListBuilds';
use Hydra::Helper::Nix;
use Hydra::Helper::CatalystUtils;
sub job : Chained('/project/project') PathPart('job') CaptureArgs(1) {
my ($self, $c, $jobName) = @_;
$c->stash->{jobName} = $jobName;
# !!! nothing to do here yet, since we don't have a jobs table.
}
sub index : Chained('job') PathPart('') Args(0) {
my ($self, $c) = @_;
$c->go($self->action_for("all"));
}
# Hydra::Base::Controller::ListBuilds needs this.
sub get_builds : Chained('job') PathPart('') CaptureArgs(0) {
my ($self, $c) = @_;
$c->stash->{allBuilds} =
$c->stash->{curProject}->builds->search({attrName => $c->stash->{jobName}});
$c->stash->{channelBaseName} =
$c->stash->{curProject}->name . "-" . $c->stash->{jobName};
}
1;

View file

@ -219,21 +219,6 @@ sub release :Local {
}
sub job :Local {
my ($self, $c, $projectName, $jobName) = @_;
$c->stash->{template} = 'job.tt';
my $project = $c->model('DB::Projects')->find($projectName);
notFound($c, "Project $projectName doesn't exist.") if !defined $project;
$c->stash->{curProject} = $project;
$c->stash->{jobName} = $jobName;
$c->stash->{builds} = [$c->model('DB::Builds')->search(
{finished => 1, project => $projectName, attrName => $jobName},
{order_by => "timestamp DESC"})];
}
# Hydra::Base::Controller::ListBuilds needs this.
sub get_builds : Chained('/') PathPart('') CaptureArgs(0) {
my ($self, $c) = @_;

View file

@ -1,7 +1,9 @@
[% WRAPPER layout.tt title="All Builds" %]
[% PROCESS common.tt %]
<h1>All Builds[% IF curProject %] in Project <tt>[% curProject.name %]</tt>[% END %]</h1>
<h1>All Builds
[% IF jobName %]for Job [% curProject.name %]:[% jobName %][% ELSE %]
[% IF curProject %] for Project <tt>[% curProject.name %]</tt>[% END %][% END %]</h1>
<p>Showing builds [% (page - 1) * resultsPerPage + 1 %] - [% (page - 1) * resultsPerPage + builds.size %]
out of [% totalBuilds %] in order of descending timestamp.</p>

View file

@ -66,7 +66,7 @@
</tr>
<tr>
<th>Job name:</th>
<td><a href="[% c.uri_for('/job' build.project.name build.attrname) %]"><tt>[% build.attrname %]</tt></a></td>
<td><a href="[% c.uri_for('/project' build.project.name 'job' build.attrname) %]"><tt>[% build.attrname %]</tt></a></td>
</tr>
<tr>
<th>Nix name:</th>

View file

@ -61,7 +61,7 @@
<td>[% build.schedulingInfo.priority %]</td>
[% END %]
<td><a href="[% c.uri_for('/project' build.get_column("project")) %]"><tt>[% build.get_column("project") %]</tt></a></td>
<td><a href="[% c.uri_for('/job' build.get_column("project") build.attrname) %]"><tt>[% build.attrname %]</tt></a></td>
<td><a href="[% c.uri_for('/project' build.get_column("project") 'job' build.attrname) %]"><tt>[% build.attrname %]</tt></a></td>
<td>[% build.resultInfo.releasename ? build.resultInfo.releasename : build.nixname %]</td>
<td><tt>[% build.system %]</tt></td>
<td>[% date.format(build.timestamp, '%Y-%m-%d %H:%M:%S') %]</td>

View file

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