jobset: Add a new "channels" tab.

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>
This commit is contained in:
aszlig
2015-04-14 08:58:55 +02:00
parent 19e7114f0e
commit 7b60aed5ed
3 changed files with 77 additions and 0 deletions

View File

@ -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) = @_;