{% extends "admin.html" %}
{% block admin_content %}
<div class="">
    <table class="table ">
        <thead>
            <tr>
                <th>Locked</th>
                <th>Task Name</th>
                <th>Status</th>
                <th>Progress</th>
                <th>Action</th>
            </tr>
        </thead>
        <tbody id="task-status" hx-get="/task_status" hx-trigger="every 1s" hx-swap="innerHTML">
            {% include 'partials/_task_status.html' %}
        </tbody>
    </table>
</div>

<hr>
<h4>Unlock blocked tasks</h4>
<div>
    <form hx-post="/unlock_key" hx-swap="outerHTML" hx-target="#empty">
        <div class="mb-3">
          <label for="inputLockKey" class="form-label">Lock Key Name</label>
          <select class="form-select form-select-lg mb-3" aria-label="Select task lock to unlock" id="inputLockKey" name="inputLockKey">
            {% for value in lock_keys %}
                <option value="{{value}}">{{value}}</option>
            {% endfor %}
            
          </select>
          <div id="inputLockKeyHelp" class="form-text">Provide a key name to to reset a lock. </div>
        </div>
        
        <button type="submit" class="btn btn-primary">Unlock</button>
      </form>
</div>
<div id="empty"></div>

{% endblock %}
