[% WRAPPER layout.tt title="Machines" %]
[% PROCESS common.tt %]

<h1>Build machines</h1>

<table>
    <thead>
        <tr>
            <th>Enabled</th>
            <th>Machine</th>
            <th>Max concurrent</th>
            <th>Speedfactor</th>
            [% FOREACH s IN systems %]<th>[% s.system %]</th>[% END %]
        </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>[% INCLUDE maybeLink uri = c.uri_for(c.controller('Admin').action_for('machine_edit'), [m.hostname]) content = m.hostname %]</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 %]
        </tr>
        [% END %]
    </tbody>
    
</table>

<p>[ <a href="[% c.uri_for(c.controller('Admin').action_for('create_machine')) %]">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 %]
