diff --git a/swh/web/templates/includes/snapshot-context.html b/swh/web/templates/includes/snapshot-context.html index 70450f3c..29f2edba 100644 --- a/swh/web/templates/includes/snapshot-context.html +++ b/swh/web/templates/includes/snapshot-context.html @@ -1,40 +1,43 @@ {% 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 %} <div class="card"> <div class="card-header bg-gray-light"> {% if snapshot_context.origin_info %} + <div class="float-left"> + <a href="{{ snapshot_context.browse_url }}" class="btn btn-default btn-sm" role="button">See visits</a> + </div> {% if snapshot_context.origin_info.url|slice:"0:4" == "http" %} <div class="float-right"> <a href="{{ snapshot_context.origin_info.url }}" class="btn btn-default btn-sm" role="button">Go to origin</a> </div> {% endif %} - <a href="{{ snapshot_context.browse_url }}"> + <a href="{% url 'browse-origin' snapshot_context.origin_info.type snapshot_context.origin_info.url %}"> <h4 class="text-center">Origin: {{ snapshot_context.origin_info.url }}</h4> <div class="clearfix"></div> </a> {% else %} <a href="{{ snapshot_context.browse_url }}"> <h4 class="text-center">Snapshot: {{ snapshot_context.snapshot_id }}</h4> <div class="clearfix"></div> </a> {% endif %} </div> <div class="swh-origin-visit-details"> <ul> {% if snapshot_context.visit_info %} <li><i class="fa fa-calendar fa-fw"></i> Visit date: <a href="{{ snapshot_context.visit_info.url }}">{{ snapshot_context.visit_info.fmt_date }}</a></li> {% endif %} <li><i class="fa fa-code-fork fa-fw"></i> <a href="{{ snapshot_context.branches_url }}">Branches ({{ snapshot_context.branches|length}})</a></li> {% if snapshot_context.releases %} <li><i class="fa fa-tag fa-fw"></i> <a href="{{ snapshot_context.releases_url }}">Releases ({{ snapshot_context.releases|length }})</a></li> {% else %} <li><i class="fa fa-tag fa-fw"></i> Releases (0)</li> {% endif %} </ul> </div> </div> diff --git a/swh/web/templates/origin-visits.html b/swh/web/templates/origin-visits.html index 2d95ba39..2621dcd4 100644 --- a/swh/web/templates/origin-visits.html +++ b/swh/web/templates/origin-visits.html @@ -1,101 +1,104 @@ {% extends "browse.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 static %} {% load swh_templatetags %} {% load render_bundle from webpack_loader %} {% block header %} {{ block.super }} {% render_bundle 'origin' %} {% endblock %} {% block swh-browse-before-panels %} <div class="card"> <div class="card-header bg-gray-light border-bottom-0"> + <div class="float-left"> + <a href="{% url 'browse-origin' origin_info.type origin_info.url %}" class="btn btn-default btn-sm" role="button">Latest snapshot</a> + </div> {% if origin_info.url|slice:"0:4" == "http" %} <div class="float-right"> <a href="{{ origin_info.url }}" class="btn btn-default btn-sm" role="button">Go to origin</a> </div> {% endif %} <a data-toggle="collapse" data-parent="#accordion" href="#swh-origin-top-collapse"> <h4 class="text-center">Origin: {{ origin_info.url }}</h4> <div class="clearfix"></div> </a> </div> <div id="swh-origin-top-collapse" class="collapse"> <table class="table"> <tbody> {% for key, val in swh_object_metadata.items|dictsort:"0.lower" %} <tr> <th class="swh-metadata-table-row">{{ key }}</th> <td class="swh-metadata-table-row"> <pre>{{ val | safe | urlize_links_and_mails | safe }}</pre> </td> </tr> {% endfor %} </tbody> </table> </div> </div> {% endblock %} {% block swh-browse-main-panel-content %} <div class="card-header bg-gray-light"> <div class="float-left"> <h4>{{ top_panel_text }}</h4> </div> <div class="clearfix"></div> </div> <div class="card-body"> <h4>Visits overview</h4> <ul> <li>Total number of visits: <b>{{ origin_visits|length }}</b></li> <li>Last full visit: <span style="margin-left: 20px;" id="swh-last-full-visit"></span></li> <li>First full visit: <span style="margin-left: 20px;" id="swh-first-full-visit"></span></li> <li>Last visit: <span style="margin-left: 20px;" id="swh-last-visit"></span></li> </ul> <h4>Visits history</h4> <div class="btn-group btn-group-toggle d-flex justify-content-center" data-toggle="buttons"> <label class="btn btn-default btn-sm form-check-label active" onclick="swh.origin.showFullVisitsDifferentSnapshots(event)"> <input type="radio" name="options" id="option1" autocomplete="off" checked> Show full visits with different snapshots </label> <label class="btn btn-default btn-sm form-check-label" onclick="swh.origin.showFullVisits(event)"> <input type="radio" name="options" id="option2" autocomplete="off"> Show all full visits </label> <label class="btn btn-default btn-sm form-check-label" onclick="swh.origin.showAllVisits(event)"> <input type="radio" name="options" id="option3" autocomplete="off"> Show all visits </label> </div> <h5>Timeline</h5> <div id="swh-visits-timeline" class="d3-wrapper"></div> <h5>Calendar</h5> <div id="swh-visits-calendar"></div> <h5>List</h5> <div id="swh-visits-list"></div> </div> <script> // all origin visits var visits = {{ origin_visits|jsonify }}; swh.origin.initVisitsReporting(visits); </script> {% endblock %}