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->{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' ] }
) ]
);
}

View file

@ -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;

View file

@ -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'
]
);