Clean up root controller

Signed-off-by: Shea Levy <shea@shealevy.com>
This commit is contained in:
Shea Levy 2013-10-24 16:12:36 -04:00
parent 5d3df69a0b
commit a89096ec5e
3 changed files with 33 additions and 24 deletions

View file

@ -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->{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 })]; $c->stash->{newsItems} = [$c->model('DB::NewsItems')->search({}, { order_by => ['createtime DESC'], rows => 5 })];
$self->status_ok($c, $self->status_ok($c,
entity => [$c->model('DB::Projects')->search(isAdmin($c) ? {} : {hidden => 0}, { entity => $c->stash->{projects}
order_by => 'name',
columns => [ 'name', 'displayname', 'description' ]
})]
); );
} }
@ -73,8 +70,7 @@ sub queue_GET {
$c->stash->{flashMsg} //= $c->flash->{buildMsg}; $c->stash->{flashMsg} //= $c->flash->{buildMsg};
$self->status_ok( $self->status_ok(
$c, $c,
entity => [$c->model('DB::Builds')->search( entity => [$c->model('DB::Builds')->search({finished => 0}, { order_by => ["priority DESC", "id"]})]
{finished => 0}, { order_by => ["priority DESC", "id"], columns => [@buildListColumns] })]
); );
} }
@ -101,22 +97,7 @@ sub status_GET {
$c, $c,
entity => [ $c->model('DB::BuildSteps')->search( entity => [ $c->model('DB::BuildSteps')->search(
{ 'me.busy' => 1, 'build.finished' => 0, 'build.busy' => 1 }, { 'me.busy' => 1, 'build.finished' => 0, 'build.busy' => 1 },
{ join => { build => [ 'project', 'job', 'jobset' ] }, { order_by => [ 'machine' ] }
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' ]
}
) ] ) ]
); );
} }

View file

@ -169,4 +169,21 @@ __PACKAGE__->has_many(
# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-06-13 01:54:50 # Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-06-13 01:54:50
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:OZsXJniZ/7EB2iSz7p5y4A # 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; 1;

View file

@ -603,8 +603,19 @@ makeQueries('ForJob', "and project = ? and jobset = ? and job = ?");
my %hint = ( my %hint = (
columns => [ columns => [
"job", 'id',
"finished" 'finished',
'timestamp',
'stoptime',
'project',
'jobset',
'job',
'nixname',
'system',
'priority',
'busy',
'buildstatus',
'releasename'
] ]
); );