diff --git a/src/lib/Hydra/Base/Controller/NixChannel.pm b/src/lib/Hydra/Base/Controller/NixChannel.pm index 19e5bf8e..3d68220c 100644 --- a/src/lib/Hydra/Base/Controller/NixChannel.pm +++ b/src/lib/Hydra/Base/Controller/NixChannel.pm @@ -130,6 +130,7 @@ sub channel_contents : Chained('nix') PathPart('') Args(0) { # garbage-collected. That should be true for the "latest" # channel. getChannelData($c, 0); + $c->stash->{genericChannel} = 1; $c->stash->{template} = 'channel-contents.tt'; $c->stash->{nixPkgs} = [sortPkgs @{$c->stash->{nixPkgs}}]; } diff --git a/src/lib/Hydra/Controller/Channel.pm b/src/lib/Hydra/Controller/Channel.pm new file mode 100644 index 00000000..033fc4de --- /dev/null +++ b/src/lib/Hydra/Controller/Channel.pm @@ -0,0 +1,57 @@ +package Hydra::Controller::Channel; + +use strict; +use warnings; +use base 'Hydra::Base::Controller::REST'; + + +sub channel : Chained('/') PathPart('channel/custom') CaptureArgs(3) { + my ($self, $c, $projectName, $jobsetName, $channelName) = @_; + + $c->stash->{project} = $c->model('DB::Projects')->find($projectName); + + notFound($c, "Project $projectName doesn't exist.") + if !$c->stash->{project}; + + $c->stash->{jobset} = $c->stash->{project}->jobsets->find({ + name => $jobsetName + }); + + notFound($c, "Jobset $jobsetName doesn't exist.") + if !$c->stash->{jobset}; + + my $lastSuccessful = $c->model('DB::Builds')->find( + { 'eval.hasnewbuilds' => 1 + , project => $projectName + , jobset => $jobsetName + , job => $channelName + , buildstatus => 0 + }, + { rows => 1, order_by => "eval.id desc" + , join => { jobsetevalmembers => 'eval' } + } + ); + + notFound($c, "Channel $channelName either doesn't exist ". + "or was never built successfully.") + if !$lastSuccessful; + + $c->stash->{lastSuccessful} = $lastSuccessful; +} + + +sub overview : Chained('channel') PathPart('') Args(0) { + my ($self, $c) = @_; + + $c->stash->{constituents} = [ + $c->stash->{lastSuccessful}->constituents_->search( + {}, {order_by => ["job"]} + ) + ]; + + $c->stash->{genericChannel} = 0; + $c->stash->{template} = 'channel-contents.tt'; +} + + +1; diff --git a/src/root/channel-contents.tt b/src/root/channel-contents.tt index b5f3d269..04619903 100644 --- a/src/root/channel-contents.tt +++ b/src/root/channel-contents.tt @@ -27,6 +27,7 @@ $ nix-env -u '*' nix-install-package program in your web browser, you can install the package simply by clicking on the packages below.

+[% IF genericChannel %]

Packages

@@ -69,5 +70,17 @@ install the package simply by clicking on the packages below.

+[% ELSE %] +[% PROCESS "product-list.tt" %] + +

Contents

+ +[% INCLUDE renderProductList build=lastSuccessful %] + +

Upgrades depend on the success/failure of the following constituents:

+ +[% INCLUDE renderBuildList builds=constituents %] + +[% END %] [% END %] diff --git a/src/root/jobset-channels-tab.tt b/src/root/jobset-channels-tab.tt index 27d1f4cf..c003d70e 100644 --- a/src/root/jobset-channels-tab.tt +++ b/src/root/jobset-channels-tab.tt @@ -22,7 +22,7 @@ [% FOREACH chan IN channels-%] - [% INCLUDE renderJobName project=project.name jobset=jobset.name job=chan %] + [% chan %] [% FOREACH eval IN evalIds %] [% r = evals.$eval.builds.$chan; IF r.id %][% INCLUDE renderBuildStatusIcon size=16 build=r %][% END %] [% END %]