* In the job status and error pages, show when the status of a job
last changed.
This commit is contained in:
@ -14,7 +14,7 @@ sub filterInactiveJobs {
|
||||
{ join => 'job'
|
||||
, '+select' => ["job.active"]
|
||||
, '+as' => ["active"]
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -26,6 +26,13 @@ sub getJobStatus {
|
||||
$latest = filterInactiveJobs($latest)
|
||||
unless defined $c->stash->{showInactiveJobs};
|
||||
|
||||
$latest = $latest->search(
|
||||
{},
|
||||
{ '+select' => ["me.statusChangeId", "me.statusChangeTime"]
|
||||
, '+as' => ["statusChangeId", "statusChangeTime"]
|
||||
, order_by => "statusChangeTime DESC"
|
||||
});
|
||||
|
||||
return $latest;
|
||||
}
|
||||
|
||||
@ -49,7 +56,7 @@ sub errors : Chained('get_builds') PathPart Args(0) {
|
||||
[$c->stash->{allJobs}->search({errormsg => {'!=' => ''}})]
|
||||
if defined $c->stash->{allJobs};
|
||||
$c->stash->{brokenBuilds} =
|
||||
[getJobStatus($self, $c)->search({buildstatus => {'!=' => 0}})];
|
||||
[getJobStatus($self, $c)->search({'me.buildstatus' => {'!=' => 0}})];
|
||||
}
|
||||
|
||||
|
||||
|
@ -193,10 +193,10 @@ __PACKAGE__->belongs_to(
|
||||
);
|
||||
|
||||
sub addSequence {
|
||||
my $hydradbi = getHydraDBPath ;
|
||||
if ($hydradbi =~ m/^dbi:Pg/) {
|
||||
__PACKAGE__->sequence('builds_id_seq');
|
||||
}
|
||||
my $hydradbi = getHydraDBPath;
|
||||
if ($hydradbi =~ m/^dbi:Pg/) {
|
||||
__PACKAGE__->sequence('builds_id_seq');
|
||||
}
|
||||
}
|
||||
|
||||
sub makeSource {
|
||||
@ -210,8 +210,14 @@ sub makeSource {
|
||||
|
||||
sub makeQueries {
|
||||
my ($name, $constraint) = @_;
|
||||
makeSource('JobStatus' . $name, "select * from (select project, jobset, job, system, max(id) as id from Builds where finished = 1 $constraint group by project, jobset, job, system) as a natural join Builds");
|
||||
makeSource('LatestSucceeded' . $name, "select * from (select project, jobset, job, system, max(id) as id from Builds natural join BuildResultInfo where finished = 1 and buildStatus = 0 $constraint group by project, jobset, job, system) as a natural join Builds");
|
||||
my $joinWithStatusChange =
|
||||
"natural join BuildResultInfo r " .
|
||||
"left join Builds b on b.id = " .
|
||||
"(select max(id) from builds c natural join buildresultinfo r2 " .
|
||||
" where x.project = c.project and x.jobset = c.jobset and x.job = c.job and x.system = c.system and " .
|
||||
" x.id > c.id and r.buildstatus != r2.buildstatus)";
|
||||
makeSource('JobStatus' . $name, "select *, b.id statusChangeId, b.timestamp statusChangeTime from (select project, jobset, job, system, max(id) as id from Builds where finished = 1 $constraint group by project, jobset, job, system) as latest natural join Builds x $joinWithStatusChange");
|
||||
makeSource('LatestSucceeded' . $name, "select * from (select project, jobset, job, system, max(id) as id from Builds natural join BuildResultInfo where finished = 1 and buildStatus = 0 $constraint group by project, jobset, job, system) as latest natural join Builds x $joinWithStatusChange");
|
||||
}
|
||||
|
||||
addSequence;
|
||||
|
Reference in New Issue
Block a user