diff --git a/src/Hydra/lib/Hydra/Base/Controller/ListBuilds.pm b/src/Hydra/lib/Hydra/Base/Controller/ListBuilds.pm index 95d91b26..b66fddf9 100644 --- a/src/Hydra/lib/Hydra/Base/Controller/ListBuilds.pm +++ b/src/Hydra/lib/Hydra/Base/Controller/ListBuilds.pm @@ -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}, {}); } diff --git a/src/Hydra/lib/Hydra/Controller/Job.pm b/src/Hydra/lib/Hydra/Controller/Job.pm new file mode 100644 index 00000000..15f21b3c --- /dev/null +++ b/src/Hydra/lib/Hydra/Controller/Job.pm @@ -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; diff --git a/src/Hydra/lib/Hydra/Controller/Root.pm b/src/Hydra/lib/Hydra/Controller/Root.pm index 6ffd29cd..fd8dfd36 100644 --- a/src/Hydra/lib/Hydra/Controller/Root.pm +++ b/src/Hydra/lib/Hydra/Controller/Root.pm @@ -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) = @_; diff --git a/src/Hydra/root/all.tt b/src/Hydra/root/all.tt index 1d90dbe4..62218696 100644 --- a/src/Hydra/root/all.tt +++ b/src/Hydra/root/all.tt @@ -1,7 +1,9 @@ [% WRAPPER layout.tt title="All Builds" %] [% PROCESS common.tt %] -
Showing builds [% (page - 1) * resultsPerPage + 1 %] - [% (page - 1) * resultsPerPage + builds.size %] out of [% totalBuilds %] in order of descending timestamp.
diff --git a/src/Hydra/root/build.tt b/src/Hydra/root/build.tt index 28209841..ddc4578b 100644 --- a/src/Hydra/root/build.tt +++ b/src/Hydra/root/build.tt @@ -66,7 +66,7 @@