{% extends "djhcup_staging_object_detail.html" %}

{% block details %}

{% if object.description %}
    {{ object.description|linebreaks }}
{% endif %}

{% if file_types %}
    <h2>File type definitions for this DataSource</h2>
    <ul>
    {% for ft in file_types %}
        <li>FileType {{ ft.id }}
            <ul>
                <li>Content: {{ ft.get_content_type_display }}</li>
                <li>Compression: {{ ft.get_compression_display }}</li>
                <li>Regex pattern: "{{ ft.pattern }}"</li>
            </ul>
        </li>
    {% endfor %}
    </ul>
{% endif %}
<h2>Import tables for this DataSource</h2>
{% if import_tables|length > 0 %}
    <ul>
    {% for i in import_tables %}
        <li>{{ i }}</li>
    {% endfor %}
    </ul>
{% elif files.load|length > 0 %}
    <p><a href="{% url 'djhcup_staging.views.src_gen_master_table' source_id=object.id %}">Generate master table</a> for this DataSource using the {{ files.load|length }} known load files</p>
{% else %}
    <p>No import tables for this DataSource, and no loading files with which to generate one. If this seems unusual, try discovering files.</p>
{% endif %}


<h2>Known files belonging to this DataSource</h2>
{% if files.content|length > 0 or files.load|length > 0 %}

    {% if files.content %}
        <h3>Content (data) files ({{ files.content|length }})</h3>
        <ul>
        {% for f in files.content %}
            <li>{{ f }}</li>
        {% endfor %}
        </ul>
    {% endif %}


    {% if files.load %}
        <h3>Loading program (meta) files ({{ files.load|length }})</h3>
        <ul>
        {% for f in files.load %}
            <li>{{ f }}</li>
        {% endfor %}
        </ul>
    {% endif %}

{% else %}
<p>No known files belong to this DataSource</p>
{% endif %}


{% endblock %}
