{% extends "./layout.html" %}

{% comment %}
Copyright (C) 2017-2018  The Software Heritage developers
See the AUTHORS file at the top-level directory of this distribution
License: GNU Affero General Public License version 3, or any later version
See top-level LICENSE file for more information
{% endcomment %}

{% load render_bundle from webpack_loader %}

{% block navbar-content %}
<h4>Download archived software</h4>
{% endblock %}

{% block browse-content %}
<p>
  This interface enables to track the status of the different Software Heritage
  Vault cooking tasks created while browsing the archive.
</p>
<p>
  Once a cooking task is finished, a link will be made available in order to
  download the associated archive.
</p>
<button type="button" class="btn btn-default btn-sm" id="vault-remove-tasks">Remove selected tasks</button>
<div class="table-responsive mt-3">
  <table class="table swh-table swh-table-striped swh-vault-table" id="vault-cooking-tasks">
    <thead>
      <tr>
        <th><input type="checkbox" id="vault-tasks-toggle-selection"/></th>
        <th style="width: 100px">Object type</th>
        <th>Object id</th>
        <th style="width: 350px">Cooking status</th>
        <th style="width: 320px"></th>
      </tr>
    </thead>
    <tbody></tbody>
  </table>
</div>
<iframe id="vault-fetch-iframe" style="display:none;"></iframe>
<div class="modal fade" id="vault-recook-object-modal" tabindex="-1" role="dialog" aria-labelledby="vault-recook-object-modal-label" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h6 class="modal-title" id="vault-recook-object-modal-label">Download link no more available</h6>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        <p>
          The requested archive is no more available to download from the Software Heritage Vault.
        </p>
        <p>
          Do you want to cook it again ?
        </p>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default btn-sm" data-dismiss="modal">Cancel</button>
        <button type="button" class="btn btn-default btn-sm" onclick="swh.vault.recookObject()">Ok</button>
      </div>
    </div>
  </div>
</div>
<script>
  swh.webapp.initPage('vault');
  swh.vault.initUi();
</script>
{% endblock %}
