Page MenuHomeSoftware Heritage

D7428.id26939.diff
No OneTemporary

D7428.id26939.diff

diff --git a/assets/src/bundles/save/index.js b/assets/src/bundles/save/index.js
--- a/assets/src/bundles/save/index.js
+++ b/assets/src/bundles/save/index.js
@@ -5,7 +5,7 @@
* See top-level LICENSE file for more information
*/
-import {csrfPost, handleFetchError, isGitRepoUrl, htmlAlert, removeUrlFragment,
+import {csrfPost, handleFetchError, isGitRepoUrl, htmlAlert,
getCanonicalOriginURL, getHumanReadableDate} from 'utils/functions';
import {swhSpinnerSrc} from 'utils/constants';
import artifactFormRowTemplate from './artifact-form-row.ejs';
@@ -240,15 +240,12 @@
swh.webapp.addJumpToPagePopoverToDataTable(saveRequestsTable);
- $('#swh-origin-save-requests-list-tab').on('shown.bs.tab', () => {
+ if (window.location.pathname === Urls.origin_save() && window.location.hash === '#requests') {
+ // Keep old URLs to the save list working
+ window.location = Urls.origin_save_list();
+ } else if ($('#swh-origin-save-requests')) {
saveRequestsTable.draw();
- window.location.hash = '#requests';
- });
-
- $('#swh-origin-save-request-help-tab').on('shown.bs.tab', () => {
- removeUrlFragment();
- $('.swh-save-request-info').popover('dispose');
- });
+ }
const saveRequestAcceptedAlert = htmlAlert(
'success',
diff --git a/cypress/integration/origin-save.spec.js b/cypress/integration/origin-save.spec.js
--- a/cypress/integration/origin-save.spec.js
+++ b/cypress/integration/origin-save.spec.js
@@ -761,7 +761,9 @@
.should('have.class', 'active');
cy.get('#swh-origin-save-requests-list-tab')
- .click()
+ .click();
+
+ cy.get('#swh-origin-save-requests-list-tab')
.should('have.class', 'active');
cy.go('back')
diff --git a/swh/web/misc/origin_save.py b/swh/web/misc/origin_save.py
--- a/swh/web/misc/origin_save.py
+++ b/swh/web/misc/origin_save.py
@@ -17,10 +17,23 @@
)
-def _origin_save_view(request):
+def _origin_save_help_view(request):
return render(
request,
- "misc/origin-save.html",
+ "misc/origin-save-help.html",
+ {
+ "heading": ("Request the saving of a software origin into the archive"),
+ "visit_types": get_savable_visit_types(
+ privileged_user(request, permissions=[SWH_AMBASSADOR_PERMISSION])
+ ),
+ },
+ )
+
+
+def _origin_save_list_view(request):
+ return render(
+ request,
+ "misc/origin-save-list.html",
{
"heading": ("Request the saving of a software origin into the archive"),
"visit_types": get_savable_visit_types(
@@ -85,7 +98,8 @@
urlpatterns = [
- url(r"^save/$", _origin_save_view, name="origin-save"),
+ url(r"^save/$", _origin_save_help_view, name="origin-save"),
+ url(r"^save/list/$", _origin_save_list_view, name="origin-save-list"),
url(
r"^save/requests/list/(?P<status>.+)/$",
_origin_save_requests_list,
diff --git a/swh/web/templates/misc/origin-save-help.html b/swh/web/templates/misc/origin-save-help.html
new file mode 100644
--- /dev/null
+++ b/swh/web/templates/misc/origin-save-help.html
@@ -0,0 +1,54 @@
+{% extends "./origin-save.html" %}
+
+{% comment %}
+Copyright (C) 2018-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 %}
+
+{% block tab_content %}
+ <div class="tab-pane active">
+ <p style="margin-top: 1rem;">A "Save code now" request takes the following parameters:</p>
+ <ul>
+ <li><b>Origin type:</b> the type of version control system the software origin is using.
+ Currently, the supported types are:
+ <ul>
+ <li><code>git</code>, for origins using <a href="https://git-scm.com/">Git</a></li>
+ <li><code>hg</code>, for origins using <a href="https://www.mercurial-scm.org/">Mercurial</a></li>
+ <li><code>svn</code>, for origins using <a href="https://subversion.apache.org/">Subversion</a></li>
+ {% if "cvs" in visit_types %}
+ <li><code>cvs</code>, for origins using <a href="http://cvs.nongnu.org/">CVS</a></li>
+ {% endif %}
+ {% if "bzr" in visit_types %}
+ <li><code>bzr</code>, for origins using <a href="https://bazaar.canonical.com/en/">Bazaar</a></li>
+ {% endif %}
+ </ul>
+ </li>
+ <li><b>Origin url:</b> the url of the remote repository for the software origin.<br/>
+ In order to avoid saving errors from Software Heritage, you should provide the clone/checkout url
+ as given by the provider hosting the software origin. <br/>It can easily be found in the
+ web interface used to browse the software origin. <br/>For instance, if you want to save a <code>git</code>
+ origin into the archive, you should check that the command <code>$ git clone &lt;origin_url&gt;</code><br/>
+ does not return an error before submitting a request.
+ </li>
+ </ul>
+ <p>
+ Once submitted, your save request can either be:
+ </p>
+ <ul>
+ <li><b>accepted:</b> a visit to the provided origin will then be scheduled by Software Heritage in order to
+ load its content into the archive as soon as possible</li>
+ <li><b>rejected:</b> the provided origin url is blacklisted and no visit will be scheduled</li>
+ <li>put in <b>pending</b> state: a manual review will then be performed in order to determine if the
+ origin can be safely loaded or not into the archive</li>
+ </ul>
+ <p>
+ Once a save request has been accepted, you can follow its current status in the
+ <a id="swh-show-origin-save-requests-list" href="#swh-origin-save-requests-list">submitted save requests list</a>.
+ <br/>
+ If you submitted requests while <a href="{% url 'oidc-login' %}">authenticated</a>, you will be able
+ to only display your own requests.
+ </p>
+ </div>
+{% endblock %}
diff --git a/swh/web/templates/misc/origin-save-list.html b/swh/web/templates/misc/origin-save-list.html
new file mode 100644
--- /dev/null
+++ b/swh/web/templates/misc/origin-save-list.html
@@ -0,0 +1,27 @@
+{% extends "./origin-save.html" %}
+
+{% comment %}
+Copyright (C) 2018-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 %}
+
+{% block tab_content %}
+ <div class="tab-pane active mt-3">
+ <table id="swh-origin-save-requests" class="table swh-table swh-table-striped" width="100%">
+ <thead>
+ <tr>
+ <th data-priority="3">Date</th>
+ <th data-priority="4">Type</th>
+ <th data-priority="1">Url</th>
+ <th data-priority="5">Request</th>
+ <th data-priority="2">Status</th>
+ <th data-priority="6">Info</th>
+ <th data-priority="7"></th>
+ </tr>
+ </thead>
+ </table>
+ <p id="swh-origin-save-request-list-error"></p>
+ </div>
+{% endblock %}
diff --git a/swh/web/templates/misc/origin-save.html b/swh/web/templates/misc/origin-save.html
--- a/swh/web/templates/misc/origin-save.html
+++ b/swh/web/templates/misc/origin-save.html
@@ -71,72 +71,13 @@
</div>
<ul class="nav nav-tabs" style="padding-left: 5px;">
- <li class="nav-item"><a class="nav-link active" data-toggle="tab" id="swh-origin-save-request-help-tab" href="#swh-origin-save-requests-create">Help</a></li>
- <li class="nav-item"><a class="nav-link" data-toggle="tab" id="swh-origin-save-requests-list-tab" href="#swh-origin-save-requests-list">Browse save requests</a></li>
+ <li class="nav-item"><a class="nav-link {% if request.resolver_match.view_name == 'origin-save' %}active{% endif %}" href="{% url 'origin-save' %}" id="swh-origin-save-request-help-tab">Help</a></li>
+ <li class="nav-item"><a class="nav-link {% if request.resolver_match.view_name == 'origin-save-list' %}active{% endif %}" href="{% url 'origin-save-list' %}" id="swh-origin-save-requests-list-tab">Browse save requests</a></li>
</ul>
<div class="tab-content">
- <div id="swh-origin-save-requests-create" class="tab-pane active">
- <p style="margin-top: 1rem;">A "Save code now" request takes the following parameters:</p>
- <ul>
- <li><b>Origin type:</b> the type of version control system the software origin is using.
- Currently, the supported types are:
- <ul>
- <li><code>git</code>, for origins using <a href="https://git-scm.com/">Git</a></li>
- <li><code>hg</code>, for origins using <a href="https://www.mercurial-scm.org/">Mercurial</a></li>
- <li><code>svn</code>, for origins using <a href="https://subversion.apache.org/">Subversion</a></li>
- {% if "cvs" in visit_types %}
- <li><code>cvs</code>, for origins using <a href="http://cvs.nongnu.org/">CVS</a></li>
- {% endif %}
- {% if "bzr" in visit_types %}
- <li><code>bzr</code>, for origins using <a href="https://bazaar.canonical.com/en/">Bazaar</a></li>
- {% endif %}
- </ul>
- </li>
- <li><b>Origin url:</b> the url of the remote repository for the software origin.<br/>
- In order to avoid saving errors from Software Heritage, you should provide the clone/checkout url
- as given by the provider hosting the software origin. <br/>It can easily be found in the
- web interface used to browse the software origin. <br/>For instance, if you want to save a <code>git</code>
- origin into the archive, you should check that the command <code>$ git clone &lt;origin_url&gt;</code><br/>
- does not return an error before submitting a request.
- </li>
- </ul>
- <p>
- Once submitted, your save request can either be:
- </p>
- <ul>
- <li><b>accepted:</b> a visit to the provided origin will then be scheduled by Software Heritage in order to
- load its content into the archive as soon as possible</li>
- <li><b>rejected:</b> the provided origin url is blacklisted and no visit will be scheduled</li>
- <li>put in <b>pending</b> state: a manual review will then be performed in order to determine if the
- origin can be safely loaded or not into the archive</li>
- </ul>
- <p>
- Once a save request has been accepted, you can follow its current status in the
- <a id="swh-show-origin-save-requests-list" href="#swh-origin-save-requests-list">submitted save requests list</a>.
- <br/>
- If you submitted requests while <a href="{% url 'oidc-login' %}">authenticated</a>, you will be able
- to only display your own requests.
- </p>
-
- </div>
-
- <div id="swh-origin-save-requests-list" class="tab-pane mt-3">
- <table id="swh-origin-save-requests" class="table swh-table swh-table-striped" width="100%">
- <thead>
- <tr>
- <th data-priority="3">Date</th>
- <th data-priority="4">Type</th>
- <th data-priority="1">Url</th>
- <th data-priority="5">Request</th>
- <th data-priority="2">Status</th>
- <th data-priority="6">Info</th>
- <th data-priority="7"></th>
- </tr>
- </thead>
- </table>
- <p id="swh-origin-save-request-list-error"></p>
- </div>
+{% block tab_content %}
+{% endblock %}
</div>
<script>

File Metadata

Mime Type
text/plain
Expires
Wed, Dec 18, 12:41 AM (2 d, 12 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3225129

Event Timeline