hydra: add missing templates

This commit is contained in:
Rob Vermaas 2010-10-18 10:50:35 +00:00
parent 4ba4571165
commit 4b3895860e
2 changed files with 127 additions and 0 deletions

77
src/root/machine.tt Normal file
View file

@ -0,0 +1,77 @@
[% WRAPPER layout.tt title=(create ? "New machine" : "Editing machine '$machine.hostname'") %]
[% PROCESS common.tt %]
<form action="[% IF create %][% c.uri_for('/admin/create-machine/submit') %][% ELSE %][% c.uri_for('/admin/machine' machine.hostname 'submit') %][% END %]" method="post">
<h2>Machine[% IF ! create %] '[% machine.hostname %]'[% END %]</h2>
<table class="layoutTable">
[% IF create %]
<tr>
<th>Hostname:</th>
<td>[% INCLUDE maybeEditString param="hostname" value=machine.hostname %]</td>
</tr>
[% END %]
<tr>
<th>Username:</th>
<td>[% INCLUDE maybeEditString param="username" value=machine.username %]</td>
</tr>
<tr>
<th>SSH key location:</th>
<td>[% INCLUDE maybeEditString param="ssh_key" value=machine.ssh_key %]</td>
</tr>
<tr>
<th>Options:</th>
<td>
[% INCLUDE maybeEditString param="options" value=machine.options %]
</td>
</tr>
<tr>
<th>Max concurrent builds:</th>
<td><tt>[% INCLUDE maybeEditString param="maxconcurrent" value=machine.maxconcurrent %]</tt></td>
</tr>
<tr>
<th>Speed factor:</th>
<td>
[% INCLUDE maybeEditString param="speedfactor" value=machine.speedfactor %]
</td>
</tr>
<tr>
<th>Systems:</th>
<td>
<select multiple name="systems" style="width: 27em;">
[% FOREACH s IN systemtypes %]
<option value="[% s.system %]"
[% checked = false %]
[% FOREACH ms IN machine.buildmachinesystemtypes %]
[% checked = ms.system == s.system %]
[% BREAK IF checked %]
[% END %]
[% IF checked %]
SELECTED
[% END %]
>[% s.system %]</option>
[% END %]
</select>
</td>
</tr>
</table>
<p><button type="submit"><img src="/static/images/success.gif" />[%IF create %]Create[% ELSE %]Apply changes[% END %]</button></p>
</form>
[% IF !create %]
<form action="[% c.uri_for('/admin/machine' machine.hostname 'delete') %]" method="post">
<p><button id="delete-machine" type="submit"><img src="/static/images/failure.gif" />Remove this machine</button></p>
</form>
<script type="text/javascript">
$("#delete-machine").click(function() {
return confirm("Are you sure you want to delete this machine?");
});
</script>
[% END %]
[% END %]

50
src/root/machines.tt Normal file
View file

@ -0,0 +1,50 @@
[% 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 %]