{% extends "web/_base.html" %}
{% block title %}Files in artifact {{ artifact.id }}
{% endblock %}

{% block content %}
    <h1>Files in artifact {{ artifact.id }}</h1>
    Download: <a href="{{ download_artifact_tar_gz_url }}">artifact</a>
    {% if download_directory_tar_gz_url %}
        || <a href="{{ download_directory_tar_gz_url }}">current directory</a>
    {% endif %}
    <p>
        Subdirectory: {{ subdirectory|default:"/" }}
    </p>
    <ul>
        <li>Id: {{ artifact.id }}</li>
        <li>Category: {{ artifact.category }}</li>
        <li>Workspace: {{ artifact.workspace.name }}</li>
        <li>Created: {{ artifact.created_at }}</li>
        <li>Expire: {{ artifact.expire_at | default:"-" }}</li>
        <li>Created by work request: {% if artifact.created_by_work_request %}
            <a href="{% url "work_requests:detail" pk=artifact.created_by_work_request %}">{{ artifact.created_by_work_request }}</a>{% else %}
            -{% endif %}</li>
        <li>Created by user: {{ artifact.created_by | default:"-" }}</li>
        <li>Data: <pre><code>{{ data_yaml }}</code></pre></li>
    </ul>
    {% if object_list %}
        <table class="table table-sm">
            <thead>
            <tr>
                <th>Name</th>
                <th>Size (bytes)</th>
                <th>Hash ({{ hash_algorithm }})</th>
            </tr>
            </thead>
            <tbody>
            {% for fileinartifact in object_list %}
                <tr>
                    <td>
                        <a href="{% url "artifacts:detail-path" artifact_id=artifact.id path=fileinartifact.path %}">{{ fileinartifact.name }}</a>
                    </td>
                    <td>
                        {{ fileinartifact.size }}
                    </td>
                    <td>
                        <code>
                            {{ fileinartifact.hash }}
                        </code>
                    </td>
                </tr>
            {% endfor %}
            </tbody>
        </table>
    {% else %}
        <p>
            The artifact does not have any files.
        </p>
    {% endif %}
    {% include "web/_pagination.html" %}
    <br>
{% endblock %}