[% PROCESS common.tt %]

[% BLOCK renderNode %]
  <li>
    [% IF done.${node.path} %]
      <tt>[% node.name %]</tt> (<a href="#[% done.${node.path} %]"><em>repeated</em></a>)
    [% ELSE %]
      [% done.${node.path} = global.nodeId; global.nodeId = global.nodeId + 1; %]
      [% IF node.refs.size > 0 %]
        <a href="javascript:" class="tree-toggle"></a>
      [% END %]
      <span id="[% done.${node.path} %]"><span class="dep-tree-line">
        [% IF node.buildStep %]
          <a href="[% c.uri_for('/build' node.buildStep.get_column('build')) %]"><tt>[% node.name %]</tt></a> [%
            IF buildStepLogExists(node.buildStep);
              INCLUDE renderLogLinks url=c.uri_for('/build' node.buildStep.get_column('build') 'nixlog' node.buildStep.stepnr);
            END %]
        [% ELSE %]
          <tt>[% node.name %]</tt> (<em>no info</em>)
        [% END %]
      </span></span>
      [% IF node.refs.size > 0 %]
        <ul class="subtree">
          [% FOREACH ref IN node.refs; INCLUDE renderNode node=ref; END %]
        </ul>
      [% END %]
    [% END %]
  </li>
[% END %]