diff --git a/src/lib/Hydra/Controller/Project.pm b/src/lib/Hydra/Controller/Project.pm index 3a58911f..633298da 100644 --- a/src/lib/Hydra/Controller/Project.pm +++ b/src/lib/Hydra/Controller/Project.pm @@ -6,9 +6,6 @@ use base 'Hydra::Base::Controller::ListBuilds'; use Hydra::Helper::Nix; use Hydra::Helper::CatalystUtils; -our @ISA = qw(Exporter); -our @EXPORT = qw(jobsetOverview); - sub project : Chained('/') PathPart('project') CaptureArgs(1) { my ($self, $c, $projectName) = @_; @@ -19,20 +16,6 @@ sub project : Chained('/') PathPart('project') CaptureArgs(1) { } -sub jobsetOverview { - my ($c, $project) = @_; - return $project->jobsets->search( isProjectOwner($c, $project->name) ? {} : { hidden => 0 }, - { order_by => "name" - , "+select" => [ - "(SELECT COUNT(*) FROM Builds AS a NATURAL JOIN BuildSchedulingInfo WHERE me.project = a.project AND me.name = a.jobset AND a.isCurrent = 1 )" - , "(SELECT COUNT(*) FROM Builds AS a NATURAL JOIN BuildResultInfo WHERE me.project = a.project AND me.name = a.jobset AND buildstatus <> 0 AND a.isCurrent = 1 )" - , "(SELECT COUNT(*) FROM Builds AS a NATURAL JOIN BuildResultInfo WHERE me.project = a.project AND me.name = a.jobset AND buildstatus = 0 AND a.isCurrent = 1 )" - , "(SELECT COUNT(*) FROM Builds AS a WHERE me.project = a.project AND me.name = a.jobset AND a.isCurrent = 1 )" - ] - , "+as" => ["nrscheduled", "nrfailed", "nrsucceeded", "nrtotal"] - }); -} - sub view : Chained('project') PathPart('') Args(0) { my ($self, $c) = @_; diff --git a/src/lib/Hydra/Helper/Nix.pm b/src/lib/Hydra/Helper/Nix.pm index f8ca760f..79d39dfe 100644 --- a/src/lib/Hydra/Helper/Nix.pm +++ b/src/lib/Hydra/Helper/Nix.pm @@ -5,6 +5,7 @@ use Exporter; use File::Path; use File::Basename; use Nix; +use Hydra::Helper::CatalystUtils; our @ISA = qw(Exporter); our @EXPORT = qw( @@ -13,7 +14,7 @@ our @EXPORT = qw( registerRoot getGCRootsDir gcRootFor getPrimaryBuildsForView getPrimaryBuildTotal - getViewResult getLatestSuccessfulViewResult ); + getViewResult getLatestSuccessfulViewResult jobsetOverview); sub isValidPath { @@ -196,6 +197,19 @@ sub findLastJobForBuilds { return $thisBuild; } +sub jobsetOverview { + my ($c, $project) = @_; + return $project->jobsets->search( isProjectOwner($c, $project->name) ? {} : { hidden => 0 }, + { order_by => "name" + , "+select" => [ + "(SELECT COUNT(*) FROM Builds AS a NATURAL JOIN BuildSchedulingInfo WHERE me.project = a.project AND me.name = a.jobset AND a.isCurrent = 1 )" + , "(SELECT COUNT(*) FROM Builds AS a NATURAL JOIN BuildResultInfo WHERE me.project = a.project AND me.name = a.jobset AND buildstatus <> 0 AND a.isCurrent = 1 )" + , "(SELECT COUNT(*) FROM Builds AS a NATURAL JOIN BuildResultInfo WHERE me.project = a.project AND me.name = a.jobset AND buildstatus = 0 AND a.isCurrent = 1 )" + , "(SELECT COUNT(*) FROM Builds AS a WHERE me.project = a.project AND me.name = a.jobset AND a.isCurrent = 1 )" + ] + , "+as" => ["nrscheduled", "nrfailed", "nrsucceeded", "nrtotal"] + }); +} sub getViewResult { my ($primaryBuild, $jobs) = @_;