[%
  buildUrl = c.uri_for('/build', build.id);
%]
[% WRAPPER layout.tt
  title="Step ${step.stepnr} of build ${build.id} of job " _ makeNameTextForJob(build.jobset, job)
  titleHTML="Step ${step.stepnr}"
           _ " of <a href=\"$buildUrl\">build ${build.id}</a>"
           _ " of job " _ linkToJob(build.jobset, job)
%]
[% PROCESS common.tt %]
[% PROCESS "build-common.tt" %]
[% USE HTML %]

[%# A step is either a real build step or a Resolved step -- a pure
    redirection to another derivation that never builds and has no log. %]
[% isResolved = step.status == 13 && step.resolveddrvpath;
   logUrl = c.uri_for('/build' build.id 'step' step.stepnr 'log');
   has_log = isResolved ? 0 : buildStepLogExists(step) %]

<table class="info-table">
  <tr>
    <th>Type:</th>
    <td>[% IF isResolved %]Resolution[% ELSIF step.type == 0 %]Build[% ELSE %]Substitution[% END %]</td>
  </tr>
  <tr>
    <th>Derivation:</th>
    <td><tt>[% step.drvpath | html %]</tt></td>
  </tr>
  [% IF step.system %]
    <tr>
      <th>System:</th>
      <td><tt>[% step.system | html %]</tt></td>
    </tr>
  [% END %]
  [% IF isResolved %]
    <tr>
      <th>Resolved to:</th>
      <td><tt>[% step.resolveddrvpath | html %]</tt></td>
    </tr>
  [% ELSE %]
    <tr>
      <th>Output store paths:</th>
      <td>[% INCLUDE renderOutputsTable outputs=step.buildstepoutputs %]</td>
    </tr>
    <tr>
      <th>Machine:</th>
      <td>[% INCLUDE renderStepMachine %]</td>
    </tr>
    <tr>
      <th>Duration:</th>
      <td>[% INCLUDE renderStepDuration %]</td>
    </tr>
  [% END %]
  <tr>
    <th>Status:</th>
    <td>
      [% INCLUDE renderStepStatus %]
      [% IF step.propagatedfrom %]
        (propagated from [% INCLUDE renderBuildIdLink id=step.propagatedfrom.get_column('id') %])
      [% END %]
    </td>
  </tr>
  [% IF resolutionOrigins && resolutionOrigins.size %]
    <tr>
      <th>Resolution target of:</th>
      <td>
        <ul class="list-unstyled mb-0">
          [% FOREACH o IN resolutionOrigins %]
            <li>
              [% INCLUDE renderBuildIdLink id=o.get_column('build') %] step #[% HTML.escape(o.stepnr) %]
              [% IF o.drvpath %]
                (originally <tt>[% HTML.escape(o.drvpath) %]</tt>)
              [% END %]
            </li>
          [% END %]
        </ul>
      </td>
    </tr>
  [% END %]
  [% IF has_log %]
    <tr>
      <th>Logfile:</th>
      <td>[% INCLUDE renderLogButtons url=logUrl %]</td>
    </tr>
  [% END %]
</table>

[% END %]
