Allow non-admin users to see the machine status page
This commit is contained in:
@ -52,23 +52,6 @@ sub admin : Chained('/') PathPart('admin') CaptureArgs(0) {
|
||||
}
|
||||
|
||||
|
||||
sub index : Chained('admin') PathPart('') Args(0) {
|
||||
my ($self, $c) = @_;
|
||||
$c->stash->{machines} = [$c->model('DB::BuildMachines')->search(
|
||||
{},
|
||||
{ order_by => ["enabled DESC", "hostname"]
|
||||
, '+select' => ["(select bs.stoptime from buildsteps as bs where bs.machine = (me.username || '\@' || me.hostname) and not bs.stoptime is null order by bs.stoptime desc limit 1)"]
|
||||
, '+as' => ['idle']
|
||||
})];
|
||||
$c->stash->{steps} = [ $c->model('DB::BuildSteps')->search(
|
||||
{ finished => 0, 'me.busy' => 1, 'build.busy' => 1, },
|
||||
{ join => [ 'build' ]
|
||||
, order_by => [ 'machine', 'stepnr' ]
|
||||
} ) ];
|
||||
$c->stash->{template} = 'admin.tt';
|
||||
}
|
||||
|
||||
|
||||
sub updateUser {
|
||||
my ($c, $user) = @_;
|
||||
|
||||
@ -119,8 +102,6 @@ sub create_user_submit : Chained('admin') PathPart('create-user/submit') Args(0)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
sub user : Chained('admin') PathPart('user') CaptureArgs(1) {
|
||||
my ($self, $c, $username) = @_;
|
||||
|
||||
|
@ -102,6 +102,23 @@ sub status :Local {
|
||||
}
|
||||
|
||||
|
||||
sub machines :Local Args(0) {
|
||||
my ($self, $c) = @_;
|
||||
$c->stash->{machines} = [$c->model('DB::BuildMachines')->search(
|
||||
{},
|
||||
{ order_by => ["enabled DESC", "hostname"]
|
||||
, '+select' => ["(select bs.stoptime from buildsteps as bs where bs.machine = (me.username || '\@' || me.hostname) and not bs.stoptime is null order by bs.stoptime desc limit 1)"]
|
||||
, '+as' => ['idle']
|
||||
})];
|
||||
$c->stash->{steps} = [ $c->model('DB::BuildSteps')->search(
|
||||
{ finished => 0, 'me.busy' => 1, 'build.busy' => 1, },
|
||||
{ join => [ 'build' ]
|
||||
, order_by => [ 'machine', 'stepnr' ]
|
||||
} ) ];
|
||||
$c->stash->{template} = 'machine-status.tt';
|
||||
}
|
||||
|
||||
|
||||
# Hydra::Base::Controller::ListBuilds needs this.
|
||||
sub get_builds : Chained('/') PathPart('') CaptureArgs(0) {
|
||||
my ($self, $c) = @_;
|
||||
|
Reference in New Issue
Block a user