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'; @@ -243,15 +243,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.+)/$", _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 %} +
+

A "Save code now" request takes the following parameters:

+ +

+ Once submitted, your save request can either be: +

+ +

+ Once a save request has been accepted, you can follow its current status in the + submitted save requests list. +
+ If you submitted requests while authenticated, you will be able + to only display your own requests. +

+
+{% 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 %} +
+ + + + + + + + + + + + +
DateTypeUrlRequestStatusInfo
+

+
+{% 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 @@
-
-

A "Save code now" request takes the following parameters:

-
    -
  • Origin type: the type of version control system the software origin is using. - Currently, the supported types are: -
      -
    • git, for origins using Git
    • -
    • hg, for origins using Mercurial
    • -
    • svn, for origins using Subversion
    • - {% if "cvs" in visit_types %} -
    • cvs, for origins using CVS
    • - {% endif %} - {% if "bzr" in visit_types %} -
    • bzr, for origins using Bazaar
    • - {% endif %} -
    -
  • -
  • Origin url: the url of the remote repository for the software origin.
    - 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.
    It can easily be found in the - web interface used to browse the software origin.
    For instance, if you want to save a git - origin into the archive, you should check that the command $ git clone <origin_url>
    - does not return an error before submitting a request. -
  • -
-

- Once submitted, your save request can either be: -

-
    -
  • accepted: 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
  • -
  • rejected: the provided origin url is blacklisted and no visit will be scheduled
  • -
  • put in pending state: a manual review will then be performed in order to determine if the - origin can be safely loaded or not into the archive
  • -
-

- Once a save request has been accepted, you can follow its current status in the - submitted save requests list. -
- If you submitted requests while authenticated, you will be able - to only display your own requests. -

- -
- -
- - - - - - - - - - - - -
DateTypeUrlRequestStatusInfo
-

-
+{% block tab_content %} +{% endblock %}