It's very similar to "jobs" and the code is pretty much the same, except that we don't do filtering on it. At least it doesn't waste space for a filter option when there are usually WAY less channel jobs than ordinary jobs.
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
RX7USXWQTA3K7KJJZKBEJ5XVCNA6DO7XCDGXNB2LMZ24BEWYKHKQC
XU4PKY3UT67BMJYUQNLNGS5CNFP3TDK3PNON2K7MQIJF74J4JAVAC
NGYZCZYXZUS6ZWAQCI7QD5PON7LHUTLMJ3KHZTPKI355RRMBJCPAC
TJPIS3UPRE4ZIPXGRO7B4KOPR7P6UDYWUKCNY6UHJQEQDXWS4XVAC
3HZY24CX4U2TO74HOY4YX3LBJIYF4DLXHCIY7J2RASAC4COMSMZAC
D5QIOJGPKQJIYBUCSC3MFJ3TXLPNZ2XMI37GXMFRVRFWWR2VMTFAC
OX6NYJDVCDX2UCJ4QQMTRJVZ535NOMCJGYCHDLCADJPQI7RMCXPQC
ODNCGFQ5FPKFI624BVMLW7PJ2EFJOR3TY66OCZM42UNNTWBCF2TQC
}
# 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];
[% PROCESS common.tt %]
[% IF channels.size == 0 %]
<div class="alert">There are no channels available.</div>
[% ELSE %]
[% evalIds = evals.keys.nsort.reverse %]
<table class="table table-striped table-condensed table-header-rotated">
<thead>
<tr>
<th style="width: 1em;">Channel</th>
[% FOREACH eval IN evalIds %]
<th class="rotate-45">
<div><span>
<a href="[% c.uri_for('/eval' eval) %]">[% INCLUDE renderRelativeDate timestamp=evals.$eval.timestamp %]</a>
</span></div></th>
[% END %]
</tr>
</thead>
<tbody>
[% FOREACH chan IN channels-%]
<tr>
<th><span>[% INCLUDE renderJobName project=project.name jobset=jobset.name job=chan %]</span></th>
[% FOREACH eval IN evalIds %]
<td>[% r = evals.$eval.channels.$chan; IF r.id %]<a href="[% c.uri_for('/build' r.id) %]">[% INCLUDE renderBuildStatusIcon size=16 build=r %]</a>[% END %]</td>
[% END %]
</tr>
[% END %]
</tbody>
</table>
[% END %]