forked from lix-project/hydra
Machine status page: Show disabled machines and some machine stats
This commit is contained in:
parent
6075ac6fed
commit
c1dd3fe4be
|
@ -9,6 +9,7 @@ use Digest::SHA1 qw(sha1_hex);
|
|||
use Nix::Store;
|
||||
use Nix::Config;
|
||||
use Encode;
|
||||
use JSON;
|
||||
|
||||
# Put this controller at top-level.
|
||||
__PACKAGE__->config->{namespace} = '';
|
||||
|
@ -109,8 +110,19 @@ sub machines :Local Args(0) {
|
|||
my $machines = getMachines;
|
||||
|
||||
# Add entry for localhost.
|
||||
${$machines}{''} //= {};
|
||||
delete ${$machines}{'localhost'};
|
||||
$machines->{''} //= {};
|
||||
delete $machines->{'localhost'};
|
||||
|
||||
my $status = $c->model('DB::SystemStatus')->find("queue-runner");
|
||||
if ($status) {
|
||||
my $ms = decode_json($status->status)->{"machines"};
|
||||
foreach my $name (keys %{$ms}) {
|
||||
$name = "" if $name eq "localhost";
|
||||
$machines->{$name} //= {disabled => 1};
|
||||
$machines->{$name}->{nrStepsDone} = $ms->{$name}->{nrStepsDone};
|
||||
$machines->{$name}->{avgStepBuildTime} = $ms->{$name}->{avgStepBuildTime} // 0;
|
||||
}
|
||||
}
|
||||
|
||||
$c->stash->{machines} = $machines;
|
||||
$c->stash->{steps} = [ $c->model('DB::BuildSteps')->search(
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
[% WRAPPER layout.tt title="Machine status" %]
|
||||
[% PROCESS common.tt %]
|
||||
[% USE format %]
|
||||
|
||||
<table class="table table-condensed table-striped">
|
||||
<thead>
|
||||
|
@ -17,9 +18,16 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<th colspan="6">
|
||||
<tt>[% name %]</tt>
|
||||
<tt [% IF m.value.disabled %]style="text-decoration: line-through;"[% END %]>[% name %]</tt>
|
||||
[% IF m.value.systemTypes %]
|
||||
([% comma=0; FOREACH system IN m.value.systemTypes %][% IF comma; %], [% ELSE; comma = 1; END %]<tt>[% system %]</tt>[% END %])
|
||||
<span class="muted" style="font-weight: normal;">
|
||||
([% comma=0; FOREACH system IN m.value.systemTypes %][% IF comma; %], [% ELSE; comma = 1; END %]<tt>[% system %]</tt>[% END %])
|
||||
</span>
|
||||
[% END %]
|
||||
[% IF m.value.nrStepsDone %]
|
||||
<span class="muted" style="font-weight: normal;">
|
||||
([% m.value.nrStepsDone %] steps done, [% f = format("%.1f"); f(m.value.avgStepBuildTime) %] s/step)
|
||||
</span>
|
||||
[% END %]
|
||||
</th>
|
||||
</tr>
|
||||
|
|
Loading…
Reference in a new issue