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

<table class="table table-condensed table-striped">
  [% FOREACH m IN machines %]
    <thead>
      <tr>
        <th colspan="5">
          [% IF m.enabled == 1 %]
            <a class="btn btn-success btn-mini" href="[% c.uri_for('/admin/machine' m.hostname 'disable' ) %]">Running</a>
          [% ELSE %]
            <a class="btn btn-danger btn-mini" href="[% c.uri_for('/admin/machine' m.hostname 'enable' ) %]">Stopped</a>
          [% END %] <tt>[% m.hostname %]</tt> (<tt>[% comma=0; FOREACH ms IN m.buildmachinesystemtypes %][% IF comma; %], [% ELSE; comma = 1; END; ms.system; END %])</tt>
        </th>
      </tr>
    </thead>
    <tbody>
      [% idle = 1 %]
      [% FOREACH step IN steps %]
        [% IF step.machine.match('@(.*)').0 == m.hostname %]
          [% idle = 0 %]
          <tr>
            <td><tt>[% INCLUDE renderFullJobName project = step.build.project.name jobset = step.build.jobset.name job = step.build.job.name %]</tt></td>
            <td><tt>[% step.system %]</tt></td>
            <td><a href="[% c.uri_for('/build' step.build.id) %]">[% step.build.id %]</a></td>
            <td><tt>[% step.drvpath.match('-(.*)').0 %]</tt></td>
            <td class='right'>[% INCLUDE renderDuration duration = curTime - step.starttime %] </td>
          </tr>
        [% END %]
      [% END %]
      [% IF idle == 1 %]
          <tr><td colspan="5">Idle since [% INCLUDE renderDuration duration = curTime - m.get_column('idle') %]</td></tr>
      [% END %]
    </tbody>
  [% END %]
</table>



[% END %]