<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <style>
        table, th, td { border: 1px solid black; }
        span { padding-left:10px; float: left; }
        </style>
    </head>

    <body>
        <h2>Node Summary: "{{ step }}{{ index }}"</h2>
        <span>
            <p><b>Design</b>: {{ design }}</p>
            <p><b>Job</b>: {{ job }}</p>
            <p><b>Node</b>: {{ step }}{{ index }}</p>
            <p><b>Status</b>: {{ status }}</p>
        </span>
        <span>
            <table>
                <tr>
                    <th>Record</th>
                    <th>Value</th>
                </tr>
                {% for record in records %}
                <tr>
                    <th>{{ record }}</th>
                    <td align="center">{{ records[record] }}</td>
                </tr>
                {% endfor %}
            </table>
        </span>
        <span>
            <table>
                <tr>
                    <th>Metrics</th>
                    <th>units</th>
                    {% for step, index in nodes %}
                    <th align="center">{{ step }}{{ index }}</th>
                    {% endfor %}
                </tr>
                {% for metric in metric_keys %}
                <tr>
                    <th>{{ metric }}</th>
                    <th>{{ metrics_unit[metric] }}</th>
                    {% for step, index in nodes %}
                        {% if errors[step, index] %}
                        <td>(failed)</td>
                        {% else %}
                        {% set value = metrics[step, index][metric] %}
                        {% if value is not none %}
                            {% set valuestr = value %}
                        {% else %}
                            {% set valuestr = "---" %}
                        {% endif %}

                        <td align="center">{{ valuestr }}</td>
                        {% endif %}
                    {% endfor %}
                </tr>
                {% endfor %}
            </table>
        </span>
    </body>

</html>
