{% block content %}
<h3>
    suvi task log for <code>{{ task_name }}</code> with {{ log|length }} entries  
    {% if proc is none %}
        {% if known %}
            <a class="pointer" hx-get="{{url_for('app_run', task_name=task_name)}}" hx-swap="none" hx-target="this"><img src="/static/img/start.png" title="start instance"></a>
        {% else %}
            <img src="/static/img/reload.png" title="task unknown/reloading" />
        {% endif %}
    {% else %}
        <a class="pointer" hx-get="{{url_for('app_stop_task', task_name=task_name)}}" hx-swap="none" hx-target="this"><img src="/static/img/stop.png" title="stop instance"></a>
    {% endif %}
    
    <a href="{{url_for('app_task_log_json', task_name=task_name)}}"><img src="/static/img/code.png" title="json" /></a>
    <a href="{{url_for('app_task_log_txt', task_name=task_name)}}"><img src="/static/img/text.png" title="txt" /></a>
</h3>

<i>Auto-reloads every second. 
    {% if proc is none %}
        Task is currently not running.
    {% else %}
        Task is currently running with PID <code>{{ proc.pid }}</code>
    {% endif %}
</i>
<table class="table table-striped table-sm mt-5">
    <thead>
        <tr>
            <th style="width: 250px">Config name</th>
            <th style="width: 200px">Timestamp</th>
            <th>Output</th>
        </tr>
    </thead>
    <tbody>
        {% for item in log|reverse %}
        {% if item.2 == 'error' %}
        <tr class="table-warning">
        {% else %}
        <tr>
        {% endif %}
            <td><code>{{ item.0 }}</code></td>
            <td><code>{{ item.1 }}</code></td>
            <td><code>{{ item.3 }}</code></td>
        </tr>
        {% endfor %}
    </tbody>
</table>
{% endblock %}