From 4c63ccb6bc76bca6dace640e94ab784b92d60eed Mon Sep 17 00:00:00 2001 From: Rob Vermaas Date: Fri, 3 Sep 2010 09:17:52 +0000 Subject: [PATCH] hydra: moves jobsetOverview sub --- src/lib/Hydra/Controller/Project.pm | 17 ----------------- src/lib/Hydra/Helper/Nix.pm | 16 +++++++++++++++- 2 files changed, 15 insertions(+), 18 deletions(-) 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) = @_;