Permalink
Browse files

machines: Read /etc/nix.machines instead of using the BuildMachines t…

…able
  • Loading branch information...
1 parent f9426f3 commit 170c7c98d081d4e22949ef980e40ccec4696734b @shlevy shlevy committed Mar 4, 2013
Showing with 9 additions and 22 deletions.
  1. +1 −5 src/lib/Hydra/Controller/Admin.pm
  2. +8 −17 src/root/machines.tt
@@ -56,11 +56,7 @@ sub users : Chained('admin') PathPart('users') Args(0) {
sub machines : Chained('admin') PathPart('machines') Args(0) {
my ($self, $c) = @_;
- $c->stash->{machines} = [$c->model('DB::BuildMachines')->search({}, {order_by => "hostname"})];
- $c->stash->{systems} = [$c->model('DB::SystemTypes')->search({}, {select => ["system"], order_by => "system" })];
- $c->stash->{nixMachines} = nixMachines($c);
- $c->stash->{nixMachinesWritable} = (-e "/etc/nix.machines" && -w "/etc/nix.machines");
-
+ $c->stash->{machines} = getMachines;
$c->stash->{template} = 'machines.tt';
}
View
@@ -8,32 +8,23 @@
<th>Machine</th>
<th>Max concurrent</th>
<th>Speed factor</th>
- [% FOREACH s IN systems %]<th>[% s.system %]</th>[% END %]
+ <th>Systems</th>
</tr>
</thead>
<tbody>
[% FOREACH m IN machines %]
<tr>
- <td><input type="checkbox" name="enabled" [% IF m.enabled == 1 %]CHECKED[% END %] onclick="window.location='[% IF m.enabled == 1 %][%c.uri_for('/admin/machine' m.hostname 'disable' )%][% ELSE %][%c.uri_for('/admin/machine' m.hostname 'enable' )%][% END %]'"/></td>
- <td><a href="[% c.uri_for(c.controller('Admin').action_for('machine_edit'), [m.hostname]) %]">[% m.hostname %]</a></td>
- <td>[% m.maxconcurrent %]</td>
- <td>[% m.speedfactor %]</td>
- [% FOREACH s IN systems %]
- <td>
- [% checked = false %]
- [% FOREACH ms IN m.buildmachinesystemtypes %]
- [% checked = ms.system == s.system %]
- [% BREAK IF checked %]
- [% END %]
- <input type="checkbox" name="system" DISABLED [% IF checked %]CHECKED[% END %]/>
- </td>
- [% END %]
+ <td><input type="checkbox" name="enabled" [% IF m.value.maxJobs > 0 %]CHECKED[% END %] disabled="true" /></td>
+ <td>[% m.key %]</a></td>
+ <td>[% m.value.maxJobs %]</td>
+ <td>[% m.value.speedFactor %]</td>
+ <td>
+ [% comma=0; FOREACH system IN m.value.systemTypes %][% IF comma; %], [% ELSE; comma = 1; END; system; END %]
+ </td>
</tr>
[% END %]
</tbody>
</table>
-<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>
-
[% END %]

0 comments on commit 170c7c9

Please sign in to comment.