hydra/src/lib/Hydra/Controller/Jobset.pm
2009-03-13 15:41:19 +00:00

40 lines
1 KiB
Perl

package Hydra::Controller::Jobset;
use strict;
use warnings;
use base 'Hydra::Base::Controller::ListBuilds';
use Hydra::Helper::Nix;
use Hydra::Helper::CatalystUtils;
sub jobset : Chained('/') PathPart('jobset') CaptureArgs(2) {
my ($self, $c, $projectName, $jobsetName) = @_;
my $project = $c->model('DB::Projects')->find($projectName)
or notFound($c, "Project $projectName doesn't exist.");
$c->stash->{project} = $project;
$c->stash->{jobset} = $project->jobsets->find({name => $jobsetName})
or notFound($c, "Jobset $jobsetName doesn't exist.");
}
sub index : Chained('jobset') PathPart('') Args(0) {
my ($self, $c) = @_;
$c->go($self->action_for("all"));
}
# Hydra::Base::Controller::ListBuilds needs this.
sub get_builds : Chained('jobset') PathPart('') CaptureArgs(0) {
my ($self, $c) = @_;
$c->stash->{allBuilds} =
$c->stash->{jobset}->builds;
$c->stash->{channelBaseName} =
$c->stash->{project}->name . "-" . $c->stash->{jobset}->name;
}
1;