{% extends "simple_basebuildpage.html" %}

{% block pagetitle %}Tasks{% endblock %}
{% block pagetable %}
    {% if not objects %}
        <p>No tasks were executed in this build!</p>
    {% else %}

            <tr>
            <th>Order</th>
            <th>Task</th>
            <th>Recipe Version</th>
            <th>Task Type</th>
            <th>Checksum</th>
            <th>Outcome</th>
            <th>Message</th>
            <th>Time</th>
            <th>CPU usage</th>
            <th>Disk I/O</th>
            <th>Script type</th>
            <th>Filesystem</th>
            <th>Depends</th>
            </tr>

            {% for task in objects %}

            <tr class="data">
                <td>{{task.order}}</td>
                <td><a name="{{task.recipe.name}}.{{task.task_name}}">
                <a href="{% url "simple-layer_versions_recipes" task.recipe.layer_version_id %}#{{task.recipe.name}}">{{task.recipe.name}}</a>.{{task.task_name}}</a></td>
                <td>{{task.recipe.version}}</td>

                {% if task.task_executed %}
                <td>Executed</td>
                {% else %}
                <td>Not Executed</td>
                {% endif %}

                <td>{{task.sstate_checksum}}</td>
                <td>{{task.get_outcome_display}}{% if task.provider %}</br>(by <a href="#{{task.provider.recipe.name}}.{{task.provider.task_name}}">{{task.provider.recipe.name}}.{{task.provider.task_name}}</a>){% endif %}
			{% if task.outcome == task.OUTCOME_CACHED %}{% for t in task.get_related_setscene %}
			<br/>({{t.task_name}} {{t.get_outcome_display}})
			{% endfor %}{%endif%}
		</td>
                <td><p>{{task.message}}</td>
                <td>{{task.elapsed_time}}</td>
                <td>{{task.cpu_usage}}</td>
                <td>{{task.disk_io}}</td>
                <td>{{task.get_script_type_display}}</td>
                <td> <table>
<tr><td>                Recipe</td><td><a target="_fileview" href="file:///{{task.recipe.file_path}}">{{task.recipe.file_path}}</a></td></tr>
<tr><td>                Source</td><td><a target="_fileview" href="file:///{{task.file_name}}">{{task.file_name}}:{{task.line_number}}</a></td></tr>
<tr><td>                Workdir</td><td><a target="_fileview" href="file:///{{task.work_directory}}">{{task.work_directory}}</a></td></tr>
<tr><td>                Log</td><td><a target="_fileview" href="file:///{{task.logfile}}">{{task.logfile}}</a><br/></td></tr>
</table>
                </td>
                <td>
            <div style="height: 3em; overflow:auto">
                {% for tt in task.task_dependencies_task.all %}
                    <a href="#{{tt.depends_on.recipe.name}}.{{tt.depends_on.task_name}}">
                    {{tt.depends_on.recipe.name}}.{{tt.depends_on.task_name}}</a><br/>
                {% endfor %}
            </div>
                </td>
                </tr>

            {% endfor %}

    {% endif %}

{% endblock %}
