{% extends "web/_base.html" %}
{% block title %}Work request{% endblock %}

{% block content %}
    <h1>Work request information</h1>
    {% if specialized_view_path %}
        <p><a href="{{ specialized_view_path }}">{{ work_request.task_name }} view</a></p>
    {% endif %}
    <ul>
        <li>Id: {{ work_request.id }}</li>
        <li>Status: {% include "web/_work_request-status.html" with status=work_request.status only %}</li>
        <li>Result: {% include "web/_work_request-result.html" with result=work_request.result only %}</li>
        <li>Worker: {% if work_request.worker %}{{ work_request.worker.name }}{% else %}N/A{% endif %}</li>
        <li>Workspace: {{ work_request.workspace.name }}</li>
        <li>Task name: {{ work_request.task_name }}</li>
        <li>Artifacts:
            <ul>
                {% for artifact in artifacts %}
                    <li>Id: <a href="{% url "artifacts:detail" artifact_id=artifact.id %}">{{ artifact.id }}</a>
                        (<a href="{% url "artifacts:detail" artifact_id=artifact.id %}?archive=tar.gz">download</a>)
                        Category: {{ artifact.category }}</li>
                {% endfor %}
            </ul>
        </li>
        <li>Created at: {{ work_request.created_at }}</li>
        <li>Started at: {{ work_request.started_at|default_if_none:"N/A" }}</li>
        <li>Duration: {% if work_request.duration != None %}
            {{ work_request.duration|floatformat:0 }} seconds
        {% else %}
            N/A
        {% endif %}
        </li>
        <li>Task data:
            <pre><code>{{ task_data }}</code></pre>
        </li>
        {% if validation_error %}
            <li>Validation error:
                <pre><code>{{ validation_error }}</code></pre>
            </li>
        {% endif %}
    </ul>
{% endblock %}
