{% extends "base.html" %}

{% block title %}Findings import - status{% endblock %}

{% block content %}
    <h1>Findings import - status</h1>

    {% if ps.upload_to_pwndoc %}
        <a href="/audits/{{ ps.audit_id }}/general" target="_blank">Audit ID: {{ ps.audit_id }}</a>
    {% else %}
        {% if ps.finished %}
            <a href="{{ url_for("api_process_findings.show_file_output", folder_name=ps.get_folder_name()) }}" download>Result file</a>
        {% else %}
            Output file is not ready yet.
        {% endif %}
    {% endif %}
    {% if ps.finished and ps.get_result_path().endswith(".json") %}
        <br><a href="{{ url_for("api_process_findings.list_findings", folder_name=ps.get_folder_name()) }}">List findings in Importer</a>
    {% endif %}
    <br><br>

    Import ID: {{ ps.get_folder_name()  }} <br>
    Scan2Report arguments: {{ ps.scan2report_args }} <br>
    Locale: {{ ps.locale }} <br>
    Files used for import:
    <br><ul>
    {% for filename in ps.stored_files %}
        <li>{{ filename }}</li>
    {% endfor %}
    </ul><br>

    <!--
    <h3>Missing templates</h3>

    <style>
        tr:nth-child(odd)   { background-color:#eee; }
        tr:nth-child(even)    { background-color:#fff; }
    </style>

    <table class="alternatingRows">
        <tr>
            <th>Filename</th>
            <th>Severity</th>
            <th>Title</th>
        </tr>
    {% for value in missing_templates %}
        <tr>
            <td>{{ value[1] }}</td>
            <td>{{ value[2] }}</td>
            <td>{{ value[3] }}</td>
        </tr>
    {% endfor %}
    </table>
    -->

    {% include 'findings_import_job_status.html' %}

    {% if not ps.finished %}
    <script>
        setTimeout(function () { location.reload(1); }, 2000);
    </script>
    {% endif %}


{% endblock %}