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 %] + +
Channel | + [% FOREACH eval IN evalIds %] ++ | + [% END %] +
---|---|
[% INCLUDE renderJobName project=project.name jobset=jobset.name job=chan %] | + [% FOREACH eval IN evalIds %] +[% r = evals.$eval.channels.$chan; IF r.id %][% INCLUDE renderBuildStatusIcon size=16 build=r %][% END %] | + [% END %] +