diff --git a/src/lib/Hydra/Controller/Jobset.pm b/src/lib/Hydra/Controller/Jobset.pm index 1d1cce63..d4a0eb5f 100644 --- a/src/lib/Hydra/Controller/Jobset.pm +++ b/src/lib/Hydra/Controller/Jobset.pm @@ -145,6 +145,46 @@ sub jobs_tab : Chained('jobsetChain') PathPart('jobs-tab') Args(0) { } +# XXX: Pretty much a rip-off of jobs-tab, make it DRY! +sub channels_tab : Chained('jobsetChain') PathPart('channels-tab') Args(0) { + my ($self, $c) = @_; + $c->stash->{template} = 'jobset-channels-tab.tt'; + + my @evals = $c->stash->{jobset}->jobsetevals->search( + { hasnewbuilds => 1}, + { order_by => "id desc", rows => 20 } + ); + + my $evals = {}; + my %channels; + + foreach my $eval (@evals) { + my @builds = $eval->builds->search( + { 'buildproducts.type' => 'file' + , 'buildproducts.subtype' => 'channel' }, + { join => ["buildproducts"] + , columns => ['id', 'job', 'finished', 'buildstatus'] } + ); + foreach my $b (@builds) { + my $jobName = $b->get_column('job'); + + $evals->{$eval->id}->{timestamp} = $eval->timestamp; + $evals->{$eval->id}->{channels}->{$jobName} = { + id => $b->id, + finished => $b->finished, + buildstatus => $b->buildstatus + }; + + $channels{$jobName} = 1; + } + } + + $c->stash->{evals} = $evals; + my @channels = sort (keys %channels); + $c->stash->{channels} = [@channels]; +} + + # Hydra::Base::Controller::ListBuilds needs this. sub get_builds : Chained('jobsetChain') PathPart('') CaptureArgs(0) { my ($self, $c) = @_; diff --git a/src/root/jobset-channels-tab.tt b/src/root/jobset-channels-tab.tt new file mode 100644 index 00000000..2a5f72a5 --- /dev/null +++ b/src/root/jobset-channels-tab.tt @@ -0,0 +1,34 @@ +[% PROCESS common.tt %] + +[% IF channels.size == 0 %] + +
There are no channels available.
+ +[% ELSE %] + + [% evalIds = evals.keys.nsort.reverse %] + + + + + [% FOREACH eval IN evalIds %] + + [% END %] + + + + [% FOREACH chan IN channels-%] + + + [% FOREACH eval IN evalIds %] + + [% END %] + + [% END %] + +
Channel +
+ [% INCLUDE renderRelativeDate timestamp=evals.$eval.timestamp %] +
[% INCLUDE renderJobName project=project.name jobset=jobset.name job=chan %][% r = evals.$eval.channels.$chan; IF r.id %][% INCLUDE renderBuildStatusIcon size=16 build=r %][% END %]
+ +[% END %] diff --git a/src/root/jobset.tt b/src/root/jobset.tt index 63ef29b9..04b0efaf 100644 --- a/src/root/jobset.tt +++ b/src/root/jobset.tt @@ -64,6 +64,7 @@
  • Jobs
  • Configuration
  • Links
  • +
  • Channels
  • @@ -165,6 +166,8 @@
    + [% INCLUDE makeLazyTab tabName="tabs-channels" uri=c.uri_for('/jobset' project.name jobset.name "channels-tab") %] +