{% extends "../body.html" %}
{% load static %}
{% load util %}
{% block content %}
<script src="{% static 'js/jobs/logs.js' %}"></script>
<a href="/ui/jobs/manage">
    <button class="btn btn-info aw-btn-action" title="Manage">
        {% include "../button/icon/return.html" %}
    </button>
</a>
{% include "../button/refresh.html" %}
<div class="table-responsive aw-data">
    <table class="table table-striped aw-text-responsive" id="aw-api-data-table">
        <tr>
            <th>Run</th>
            <th>Job</th>
            <th class="aw-responsive-med">Comment</th>
            <th>Actions</th>
        </tr>
        <tr id="aw-api-data-tmpl-row" hidden="hidden">
            <td></td>
            <td></td>
            <td class="aw-responsive-med"></td>
            <td></td>
        </tr>
    </table>
    <div id="aw-api-data-tmpl-actions" hidden="hidden">
        <button class="btn btn-primary aw-btn-action aw-api-click" title="Restart Job" aw-api-endpoint="job" aw-api-item="${JOB_ID}" aw-api-method="post">
            {% include "../button/icon/run.html" %}
        </button>
        <button class="btn btn-danger aw-btn-action aw-api-click" title="Stop Execution" aw-api-endpoint="job"
                aw-api-item="${JOB_ID}/${ID}" aw-api-method="delete">
            {% include "../button/icon/stop.html" %}
        </button>
        <a href="/ui/jobs/manage/job/${JOB_ID}">
            <button class="btn btn-warning aw-btn-action" title="Edit">
                {% include "../button/icon/edit.html" %}
            </button>
        </a>
        <button class="btn btn-info aw-btn-action aw-btn-expand aw-log-read" title="Show Logs"
                aw-expand="aw-spoiler-${ID}" aw-log="aw-execution-logs-${ID}"
                aw-job="${JOB_ID}" aw-exec="${ID}" aw-log-line="0"
                aw-log-end="aw-log-end-${ID}">
            {% include "../button/icon/expand.html" %}
        </button>
    </div>
    <div id="aw-api-data-tmpl-logs" hidden="hidden">
        <div>
            <b>LOG FILES</b>:
            <a href="${LOG_STDOUT_URL}" title="${LOG_STDOUT}" download>Job Output</a>,
            <a href="${LOG_STDERR_URL}" title="${LOG_STDERR}" download>Job Error</a>,
            <a href="${LOG_STDOUT_REPO_URL}" title="${LOG_STDOUT_REPO}" download>Repository Output</a>,
            <a href="${LOG_STDERR_REPO_URL}" title="${LOG_STDERR_REPO}" download>Repository Error</a>
        </div>
        <div id="aw-execution-logs-${ID}" class="aw-execution-logs"></div>
        <div>
            <button type="submit" title="Collapse" class="btn btn-info aw-btn-action aw-btn-collapse" aw-collapse="aw-spoiler-${ID}"
            id="aw-log-end-${ID}">
                {% include "../button/icon/collapse.html" %}
            </button>
            <button class="btn btn-danger aw-btn-action aw-api-click" title="Stop Execution" aw-api-endpoint="job"
                    aw-api-item="${JOB_ID}/${ID}" aw-api-method="delete">
                {% include "../button/icon/stop.html" %}
            </button>
        </div>
    </div>
</div>
{% endblock %}
