forked from lix-project/hydra
Allow non-admin users to see the machine status page
This commit is contained in:
parent
656b1bd45a
commit
7da2398f27
|
@ -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 {
|
sub updateUser {
|
||||||
my ($c, $user) = @_;
|
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) {
|
sub user : Chained('admin') PathPart('user') CaptureArgs(1) {
|
||||||
my ($self, $c, $username) = @_;
|
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.
|
# Hydra::Base::Controller::ListBuilds needs this.
|
||||||
sub get_builds : Chained('/') PathPart('') CaptureArgs(0) {
|
sub get_builds : Chained('/') PathPart('') CaptureArgs(0) {
|
||||||
my ($self, $c) = @_;
|
my ($self, $c) = @_;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[% WRAPPER layout.tt title="All builds" _
|
[% WRAPPER layout.tt title="Recent builds" _
|
||||||
(job ? " for job $project.name:$jobset.name:$job.name" :
|
(job ? " for job $project.name:$jobset.name:$job.name" :
|
||||||
jobset ? " for jobset $project.name:$jobset.name" :
|
jobset ? " for jobset $project.name:$jobset.name" :
|
||||||
project ? " for project $project.name" : "") %]
|
project ? " for project $project.name" : "") %]
|
||||||
|
|
|
@ -36,12 +36,4 @@
|
||||||
|
|
||||||
<p><a class="btn" href="[% c.uri_for(c.controller('Admin').action_for('create_machine')) %]"><i class="icon-plus"></i> Add a new machine</a></p>
|
<p><a class="btn" href="[% c.uri_for(c.controller('Admin').action_for('create_machine')) %]"><i class="icon-plus"></i> Add a new machine</a></p>
|
||||||
|
|
||||||
<p>
|
|
||||||
Resulting <tt>/etc/nix.machines</tt> [% IF nixMachinesWritable == 0 %](note: file is not writable!)[% END%]:
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<pre>
|
|
||||||
[% nixMachines %]
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
[% END %]
|
[% END %]
|
||||||
|
|
|
@ -31,10 +31,10 @@
|
||||||
uri = c.uri_for(c.controller('Root').action_for('queue'))
|
uri = c.uri_for(c.controller('Root').action_for('queue'))
|
||||||
title = "Queue ("_ nrRunningBuilds _"/"_ nrQueuedBuilds _")" %]
|
title = "Queue ("_ nrRunningBuilds _"/"_ nrQueuedBuilds _")" %]
|
||||||
[% INCLUDE makeLink
|
[% INCLUDE makeLink
|
||||||
uri = c.uri_for(c.controller(Root).action_for('status'))
|
uri = c.uri_for(c.controller('Root').action_for('status'))
|
||||||
title = "Active build steps" %]
|
title = "Active build steps" %]
|
||||||
[% INCLUDE makeLink
|
[% INCLUDE makeLink
|
||||||
uri = c.uri_for(c.controller('Admin').action_for('index'))
|
uri = c.uri_for(c.controller('Root').action_for('machines'))
|
||||||
title = "Machine status" %]
|
title = "Machine status" %]
|
||||||
[% INCLUDE makeLink
|
[% INCLUDE makeLink
|
||||||
uri = c.uri_for(c.controller('Root').action_for('all'))
|
uri = c.uri_for(c.controller('Root').action_for('all'))
|
||||||
|
|
Loading…
Reference in a new issue