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

<!DOCTYPE html>

{% load js_reverse %}
{% load static %}
{% load render_bundle from webpack_loader %}

<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>Software Heritage archive coverage</title>
    {% render_bundle 'vendors' %}
    {% render_bundle 'webapp' %}
    <script>
/*
@licstart  The following is the entire license notice for the JavaScript code in this page.

Copyright (C) 2015-2021  The Software Heritage developers

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

@licend  The above is the entire license notice for the JavaScript code in this page.
*/
    </script>
    <script src="{% url 'js_reverse' %}" type="text/javascript"></script>
    <base target="_parent">
  </head>

  <body style="padding-bottom: 0;">
    <div class="wrapper" style="margin-left: 0;" data-iframe-height>
      <div class="content">
        <div class="container-fluid">
          <p>
            A significant amount of source code has already been ingested in the Software Heritage
            archive. It notably includes the following software origins.
          </p>
          {% for origins_type, origins_data in origins.items %}
            <h5>{{ origins_type }}</h5>
            <p>{{ origins_data.info | safe }}</p>
            <div class="row">
              {% for origins in origins_data.origins %}
                <div class="col-md-4 swh-coverage-col">
                  <div class="card swh-coverage" id="{{ origins.type }}" title="{{ origins.info }}">
                    <a href="{{ origins.info_url }}" target="_blank" rel="noopener noreferrer">
                      {% with 'img/logos/'|add:origins.type.lower|add:'.png' as png_logo %}
                        <img class="card-img-top swh-coverage-logo" src="{% static png_logo %}"
                             alt="{{ origins.type }}">
                      {% endwith %}
                    </a>
                    <div class="card-header swh-coverage-header">
                      <a class="collapsed d-block" data-toggle="collapse"
                         href="#swh-coverage-info-{{ origins_type.lower|cut:' ' }}"
                         aria-expanded="true" aria-controls="swh-coverage-info-{{ origins_type.lower|cut:' ' }}"
                         id="heading-collapsed"
                         title="click to expand or collapse detailed information about software origins">
                        <i class="swh-coverage-chevron mdi mdi-24px mdi-chevron-down"></i>
                        <div class="text-center" style="font-size: 120%">
                          {% if "count" in origins and origins.count %}
                            {{ origins.count }} origins
                          {% else %}
                            <br/>
                          {% endif %}
                        </div>
                      </a>
                    </div>
                    <div id="swh-coverage-info-{{ origins_type.lower|cut:' ' }}" class="collapse"
                         aria-labelledby="heading-collapsed">
                      <div class="card-body text-center swh-coverage-info-body">
                        <table style="width: 100%">
                        {% if "instances" in origins %}
                          <thead>
                            <tr>
                              <th>instance</th>
                              <th>type</th>
                              <th>count</th>
                              <th>search</th>
                            </tr>
                          </thead>
                          <tbody>
                            {% for instance, visit_types in origins.instances.items %}
                              {% for visit_type, data in visit_types.items %}
                                {% if data.count %}
                                  <tr>
                                    <td>{{ instance }}</td>
                                    <td>{{ visit_type }}</td>
                                    <td>{{ data.count }}</td>
                                    <td>
                                      <a href="{{ data.search_url }}" target="_blank" rel="noopener noreferrer">
                                        <i class="mdi mdi-magnify"></i>
                                      </a>
                                    </td>
                                  </tr>
                                {% endif %}
                              {% endfor %}
                            {% endfor %}
                          </tbody>
                        {% else %}
                          <thead>
                            <tr>
                              <th>instance</th>
                              <th>type</th>
                              <th>search</th>
                            </tr>
                          </thead>
                          <tbody>
                          {% for visit_type, search_url in origins.search_urls.items %}
                            <tr>
                              <td>{{ origins.type }}</td>
                              <td>{{ visit_type }}</td>
                              <td>
                                <a href="{{ search_url }}" target="_blank" rel="noopener noreferrer">
                                  <i class="mdi mdi-magnify"></i>
                                </a>
                              </td>
                            </tr>
                          {% endfor %}
                          </tbody>
                        {% endif %}
                        </table>
                      </div>
                    </div>
                  </div>
                </div>
              {% endfor %}
            </div>
          {% endfor %}
        </div>
      </div>
    </div>
    <a href="{% url 'jslicenses' %}" rel="jslicense" style="display: none;">JavaScript license information</a>
  </body>
</html>
