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UQC
J7EE2XZAB5EZICAZGZ6DKM4JDMH73A5AJIW6INYMWJHENIGVANQAC
ZI535LI6PJMKSOBJE33B3RRZ5S2JVTR3XPUDTSXJW6BZNTAHS3GQC
D5QIOJGPKQJIYBUCSC3MFJ3TXLPNZ2XMI37GXMFRVRFWWR2VMTFAC
TFK74CQRYCOR2RAUZ6LATA3IJVR7QCWSPCMTXCJPPDPIRS7D5UTQC
OX6NYJDVCDX2UCJ4QQMTRJVZ535NOMCJGYCHDLCADJPQI7RMCXPQC
3PNG7NIBQQURUUPRVQXYL342OT7JUUYOMY2JJNP6YDX7SYJDZMYAC
FGQPXZIX7EUHGILJWL6PCQQ54OYA53E6K2HUL765GKYOMK6U23QQC
PZL3SZM3U3BYJX2RGYXC6NMBG7WQHFWHSYDYXZ7Q5VZA3EDYVPIQC
JARRBLZDQ2JZWY7IUVPTOT7WJMBPMLFLF2MGLVGOYROAAISYGLSAC
# Get the active / inactive jobs in this jobset.
my @jobs = $c->stash->{jobset}->jobs->search(
{ },
{ select => [
"name",
\ ("exists (select 1 from builds where project = '$projectName' and jobset = '$jobsetName' and job = me.name and isCurrent = 1) as active")
]
, as => ["name", "active"]
, order_by => ["name"] });
$c->stash->{evals} = getEvals($self, $c, scalar $c->stash->{jobset}->jobsetevals, 0, 10);
($c->stash->{latestEval}) = $c->stash->{jobset}->jobsetevals->search({}, { limit => 1, order_by => ["id desc"] });
}
sub jobs_tab : Chained('jobset') PathPart('jobs-tab') Args(0) {
my ($self, $c) = @_;
$c->stash->{template} = 'jobset-jobs-tab.tt';
foreach my $job (@jobs) {
if ($job->get_column('active')) {
push @{$c->stash->{activeJobs}}, $job->name;
} else {
(my $latestEval) = $c->stash->{jobset}->jobsetevals->search(
{ hasnewbuilds => 1}, { limit => 1, order_by => ["id desc"] });
my %activeJobs;
if (defined $latestEval) {
foreach my $build ($latestEval->builds->search({}, { order_by => ["job"], select => ["job"] })) {
my $job = $build->get_column("job");
if (!defined $activeJobs{$job}) {
$activeJobs{$job} = 1;
push @{$c->stash->{activeJobs}}, $job;
}
}
}
foreach my $job ($c->stash->{jobset}->jobs->search({}, { order_by => ["name"] })) {
if (!defined $activeJobs{$job->name}) {
if($forceStatus || scalar(@{$c->stash->{activeJobs}}) <= 100) {
my @select = ();
my @as = ();
push(@select, "job"); push(@as, "job");
foreach my $system (@systems) {
push(@select, "(select buildstatus from Builds b where b.id = (select max(id) from Builds t where t.project = me.project and t.jobset = me.jobset and t.job = me.job and t.system = '$system' and t.iscurrent = 1 ))");
push(@as, $system);
push(@select, "(select b.id from Builds b where b.id = (select max(id) from Builds t where t.project = me.project and t.jobset = me.jobset and t.job = me.job and t.system = '$system' and t.iscurrent = 1 ))");
push(@as, "$system-build");
}
$c->stash->{activeJobsStatus} =
[ $c->model('DB')->resultset('ActiveJobsForJobset')->search(
{},
{ bind => [$c->stash->{project}->name, $c->stash->{jobset}->name]
, select => \@select
, as => \@as
, order_by => ["job"]
})];
my @select = ();
my @as = ();
push(@select, "job"); push(@as, "job");
foreach my $system (@systems) {
push(@select, "(select buildstatus from Builds b where b.id = (select max(id) from Builds t where t.project = me.project and t.jobset = me.jobset and t.job = me.job and t.system = '$system' and t.iscurrent = 1 ))");
push(@as, $system);
push(@select, "(select b.id from Builds b where b.id = (select max(id) from Builds t where t.project = me.project and t.jobset = me.jobset and t.job = me.job and t.system = '$system' and t.iscurrent = 1 ))");
push(@as, "$system-build");
}
sub index : Chained('jobset') PathPart('') Args(0) {
my ($self, $c) = @_;
jobsetIndex($self, $c, 0);
}
sub indexWithStatus : Chained('jobset') PathPart('') Args(1) {
my ($self, $c, $forceStatus) = @_;
jobsetIndex($self, $c, 1);
$c->stash->{activeJobsStatus} = [
$c->model('DB')->resultset('ActiveJobsForJobset')->search(
{},
{ bind => [$c->stash->{project}->name, $c->stash->{jobset}->name]
, select => \@select
, as => \@as
, order_by => ["job"]
}) ];
[% PROCESS common.tt %]
<p>This jobset currently contains the following [% activeJobs.size %] jobs:
<blockquote>
[% IF activeJobs.size == 0 %]<em>(none)</em>[% END %]
[% FOREACH j IN activeJobs %][% INCLUDE renderJobName project=project.name jobset=jobset.name job=j %]<br/>[% END %]
</blockquote>
</p>
<p>This jobset used to contain the following [% inactiveJobs.size %] jobs:
<blockquote>
[% IF inactiveJobs.size == 0 %]<em>(none)</em>[% END %]
[% FOREACH j IN inactiveJobs %][% INCLUDE renderJobName project=project.name jobset=jobset.name job=j %]<br/>[% END %]
</blockquote>
</p>
[% PROCESS common.tt %]
<table class="table table-striped table-condensed">
<thead><tr><th>Job</th>[% FOREACH s IN systems %]<th>[% s.system %]</th>[% END %]</tr></thead>
<tbody>
[% odd = 0 %]
[% FOREACH j IN activeJobsStatus %]
<tr class="[% IF odd %] odd [% END; odd = !odd %]">
<td>[% INCLUDE renderJobName project=project.name jobset = jobset.name job = j.get_column('job') %]</td>
[% FOREACH s IN systems %]
[% system = s.system %]
[% systemStatus = j.get_column(system) %]
<td class="centered">
[% IF systemStatus != undef %]
<a href="[% c.uri_for('/build' j.get_column(system _ '-build') ) %]">
[% INCLUDE renderBuildStatusIcon buildstatus=systemStatus size=16 %]
</a>
[% END %]
</td>
[% END %]
</tr>
[% END %]
</tbody>
</table>
<div id="tabs-status" class="tab-pane">
[% IF activeJobsStatus %]
<table class="table table-striped table-condensed">
<thead><tr><th>Job</th>[% FOREACH s IN systems %]<th>[% s.system %]</th>[% END %]</tr></thead>
<tbody>
[% odd = 0 %]
[% FOREACH j IN activeJobsStatus %]
<tr class="[% IF odd %] odd [% END; odd = !odd %]">
<td>[% INCLUDE renderJobName project=project.name jobset = jobset.name job = j.get_column('job') %]</td>
[% FOREACH s IN systems %]
[% system = s.system %]
[% systemStatus = j.get_column(system) %]
<td class="centered">
[% IF systemStatus != undef %]
<a href="[% c.uri_for('/build' j.get_column(system _ '-build') ) %]">
[% INCLUDE renderBuildStatusIcon buildstatus=systemStatus size=16 %]
</a>
[% END %]
</td>
[% END %]
</tr>
[% END %]
</tbody>
</table>
[% ELSE %]
<h2>Status</h2>
<p>
[ <a href="[% c.uri_for('/jobset' project.name jobset.name 'with-status' ) %]">Show status overview</a> ]
</p>
[% END %]
<p>This jobset currently contains the following [% activeJobs.size %] jobs:
<blockquote>
[% IF activeJobs.size == 0 %]<em>(none)</em>[% END %]
[% FOREACH j IN activeJobs %][% INCLUDE renderJobName project=project.name jobset=jobset.name job=j %]<br/>[% END %]
</blockquote>
</p>
<p>This jobset used to contain the following [% inactiveJobs.size %] jobs:
<blockquote>
[% IF inactiveJobs.size == 0 %]<em>(none)</em>[% END %]
[% FOREACH j IN inactiveJobs %][% INCLUDE renderJobName project=project.name jobset=jobset.name job=j %]<br/>[% END %]
</blockquote>
</p>
</div>