From 3af294f848ab97e936c63f9e2d53ab82e079f412 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 13 Mar 2009 15:23:08 +0000 Subject: [PATCH] * Make jobsets viewable under http://server/jobset//. --- src/lib/Hydra/Controller/Job.pm | 2 +- src/lib/Hydra/Controller/Jobset.pm | 39 ++++++++++++++++++++++++++++++ src/root/all.tt | 5 ++-- 3 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 src/lib/Hydra/Controller/Jobset.pm diff --git a/src/lib/Hydra/Controller/Job.pm b/src/lib/Hydra/Controller/Job.pm index 5a8d5440..1caf1757 100644 --- a/src/lib/Hydra/Controller/Job.pm +++ b/src/lib/Hydra/Controller/Job.pm @@ -35,7 +35,7 @@ sub get_builds : Chained('job') PathPart('') CaptureArgs(0) { $c->stash->{allBuilds} = $c->stash->{jobset}->builds->search({job => $c->stash->{jobName}}); $c->stash->{channelBaseName} = - $c->stash->{curProject}->name . "-" . $c->stash->{jobName}; + $c->stash->{curProject}->name . "-" . $c->stash->{jobset}->name . "-" . $c->stash->{jobName}; } diff --git a/src/lib/Hydra/Controller/Jobset.pm b/src/lib/Hydra/Controller/Jobset.pm new file mode 100644 index 00000000..d694c332 --- /dev/null +++ b/src/lib/Hydra/Controller/Jobset.pm @@ -0,0 +1,39 @@ +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->{curProject} = $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->{curProject}->name . "-" . $c->stash->{jobset}->name; +} + + +1; diff --git a/src/root/all.tt b/src/root/all.tt index e6f53964..efc58cfe 100644 --- a/src/root/all.tt +++ b/src/root/all.tt @@ -2,8 +2,9 @@ [% PROCESS common.tt %]

All Builds - [% IF jobName %]for Job [% curProject.name %]:[% jobset.name %]:[% jobName %][% ELSE %] - [% IF curProject %] for Project [% curProject.name %][% END %][% END %]

+ [% IF jobName %]for Job [% curProject.name %]:[% jobset.name %]:[% jobName %] + [% ELSIF jobset %]for Jobset [% curProject.name %]:[% jobset.name %] + [% ELSIF curProject %] for Project [% curProject.name %][% END %]

Showing builds [% (page - 1) * resultsPerPage + 1 %] - [% (page - 1) * resultsPerPage + builds.size %] out of [% totalBuilds %] in order of descending timestamp.