From a89096ec5e8f57e793dfcc09176d1609e9567fdd Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Thu, 24 Oct 2013 16:12:36 -0400 Subject: [PATCH] Clean up root controller Signed-off-by: Shea Levy --- src/lib/Hydra/Controller/Root.pm | 25 +++---------------------- src/lib/Hydra/Schema/BuildSteps.pm | 17 +++++++++++++++++ src/lib/Hydra/Schema/Builds.pm | 15 +++++++++++++-- 3 files changed, 33 insertions(+), 24 deletions(-) diff --git a/src/lib/Hydra/Controller/Root.pm b/src/lib/Hydra/Controller/Root.pm index 281cc90c..edd6997c 100644 --- a/src/lib/Hydra/Controller/Root.pm +++ b/src/lib/Hydra/Controller/Root.pm @@ -57,10 +57,7 @@ sub index :Path :Args(0) { $c->stash->{projects} = [$c->model('DB::Projects')->search(isAdmin($c) ? {} : {hidden => 0}, {order_by => 'name'})]; $c->stash->{newsItems} = [$c->model('DB::NewsItems')->search({}, { order_by => ['createtime DESC'], rows => 5 })]; $self->status_ok($c, - entity => [$c->model('DB::Projects')->search(isAdmin($c) ? {} : {hidden => 0}, { - order_by => 'name', - columns => [ 'name', 'displayname', 'description' ] - })] + entity => $c->stash->{projects} ); } @@ -73,8 +70,7 @@ sub queue_GET { $c->stash->{flashMsg} //= $c->flash->{buildMsg}; $self->status_ok( $c, - entity => [$c->model('DB::Builds')->search( - {finished => 0}, { order_by => ["priority DESC", "id"], columns => [@buildListColumns] })] + entity => [$c->model('DB::Builds')->search({finished => 0}, { order_by => ["priority DESC", "id"]})] ); } @@ -101,22 +97,7 @@ sub status_GET { $c, entity => [ $c->model('DB::BuildSteps')->search( { 'me.busy' => 1, 'build.finished' => 0, 'build.busy' => 1 }, - { join => { build => [ 'project', 'job', 'jobset' ] }, - columns => [ - 'me.machine', - 'me.system', - 'me.stepnr', - 'me.drvpath', - 'me.starttime', - 'build.id', - { - 'build.project.name' => 'project.name', - 'build.jobset.name' => 'jobset.name', - 'build.job.name' => 'job.name' - } - ], - order_by => [ 'machine' ] - } + { order_by => [ 'machine' ] } ) ] ); } diff --git a/src/lib/Hydra/Schema/BuildSteps.pm b/src/lib/Hydra/Schema/BuildSteps.pm index 742abe35..64bddd07 100644 --- a/src/lib/Hydra/Schema/BuildSteps.pm +++ b/src/lib/Hydra/Schema/BuildSteps.pm @@ -169,4 +169,21 @@ __PACKAGE__->has_many( # Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-06-13 01:54:50 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:OZsXJniZ/7EB2iSz7p5y4A +my %hint = ( + columns => [ + "machine", + "system", + "stepnr", + "drvpath", + "starttime", + ], + eager_relations => { + build => 'id' + } +); + +sub json_hint { + return \%hint; +} + 1; diff --git a/src/lib/Hydra/Schema/Builds.pm b/src/lib/Hydra/Schema/Builds.pm index d7337697..31b26fbd 100644 --- a/src/lib/Hydra/Schema/Builds.pm +++ b/src/lib/Hydra/Schema/Builds.pm @@ -603,8 +603,19 @@ makeQueries('ForJob', "and project = ? and jobset = ? and job = ?"); my %hint = ( columns => [ - "job", - "finished" + 'id', + 'finished', + 'timestamp', + 'stoptime', + 'project', + 'jobset', + 'job', + 'nixname', + 'system', + 'priority', + 'busy', + 'buildstatus', + 'releasename' ] );