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

{% comment %}
Copyright (C) 2018-2022  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 %}


{% block tab_content %}
  <div id="swh-origin-save-url-filters" class="tab-pane active">
    <ul class="nav nav-pills mt-3 mb-3" role="tablist">
      <li class="nav-item">
        <a class="nav-link active" id="swh-authorized-origins-tab" data-toggle="pill" href="#swh-authorized-origins" role="tab" aria-controls="swh-authorized-origins"
          aria-selected="true">Authorized urls</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" id="swh-unauthorized-origins-tab" data-toggle="pill" href="#swh-unauthorized-origins" role="tab" aria-controls="swh-unauthorized-origins"
          aria-selected="false">Unauthorized urls</a>
      </li>
    </ul>

    <div class="tab-content">
      <div class="tab-pane fade show active" id="swh-authorized-origins" role="tabpanel" aria-labelledby="swh-authorized-origins-tab">
        <table id="swh-authorized-origin-urls" class="table swh-table swh-table-striped" width="100%">
          <thead>
            <tr>
              <th>Url</th>
            </tr>
          </thead>
        </table>
        <div class="row text-right mt-3">
          <div class="col-md-10">
            <div class="input-group">
              <input class="form-control" placeholder="Enter authorized origin url prefix to add" type="text" id="swh-authorized-url-prefix"/>
              <div class="input-group-append">
                <button id="swh-add-authorized-origin-url" class="btn btn-default" onclick="swh.admin.addAuthorizedOriginUrl()">Add new</button>
              </div>
            </div>
          </div>
          <div class="col-md-2">
            <button id="swh-remove-authorized-origin-url" class="btn btn-default swh-action-need-selection" onclick="swh.admin.removeAuthorizedOriginUrl()" disabled>Remove selected</button>
          </div>
        </div>
        <div class="row mt-3 swh-add-authorized-origin-status">
        </div>
      </div>

      <div class="tab-pane fade" id="swh-unauthorized-origins" role="tabpanel" aria-labelledby="swh-unauthorized-origins-tab">
        <table id="swh-unauthorized-origin-urls" class="table swh-table swh-table-striped" width="100%">
          <thead>
            <tr>
              <th>Url</th>
            </tr>
          </thead>
        </table>
        <div class="row text-right mt-3">
          <div class="col-md-10">
            <div class="input-group">
              <input class="form-control" placeholder="Enter unauthorized origin url prefix to add" type="text" id="swh-unauthorized-url-prefix"/>
              <div class="input-group-append">
                <button id="swh-add-unauthorized-origin-url" class="btn btn-default" onclick="swh.admin.addUnauthorizedOriginUrl()">Add new</button>
              </div>
            </div>
          </div>
          <div class="col-md-2">
            <button id="swh-remove-unauthorized-origin-url" class="btn btn-default swh-action-need-selection" onclick="swh.admin.removeUnauthorizedOriginUrl()" disabled>Remove selected</button>
          </div>
        </div>
        <div class="row mt-3 swh-add-unauthorized-origin-status">
        </div>
      </div>
    </div>
  </div>
{% endblock %}
