diff --git a/assets/src/bundles/admin/origin-save.js b/assets/src/bundles/admin/origin-save.js --- a/assets/src/bundles/admin/origin-save.js +++ b/assets/src/bundles/admin/origin-save.js @@ -178,14 +178,6 @@ enableRowSelection('#swh-origin-save-accepted-requests'); swh.webapp.addJumpToPagePopoverToDataTable(acceptedSaveRequestsTable); - $('#swh-origin-save-requests-nav-item').on('shown.bs.tab', () => { - pendingSaveRequestsTable.draw(); - }); - - $('#swh-origin-save-url-filters-nav-item').on('shown.bs.tab', () => { - authorizedOriginTable.draw(); - }); - $('#swh-authorized-origins-tab').on('shown.bs.tab', () => { authorizedOriginTable.draw(); }); diff --git a/cypress/integration/admin.spec.js b/cypress/integration/admin.spec.js --- a/cypress/integration/admin.spec.js +++ b/cypress/integration/admin.spec.js @@ -1,5 +1,5 @@ /** - * Copyright (C) 2019-2021 The Software Heritage developers + * Copyright (C) 2019-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 @@ -7,7 +7,7 @@ const $ = Cypress.$; -const defaultRedirect = '/admin/origin/save/'; +const defaultRedirect = '/admin/origin/save/requests/'; let url; @@ -40,7 +40,7 @@ cy.adminLogin(); cy.visit(url); - cy.get(`.sidebar a[href="${this.Urls.admin_origin_save()}"]`) + cy.get(`.sidebar a[href="${this.Urls.admin_origin_save_requests()}"]`) .should('be.visible'); cy.get(`.sidebar a[href="${this.Urls.admin_deposit()}"]`) @@ -76,7 +76,7 @@ }); it('should prevent unauthorized access after logout', function() { - cy.visit(this.Urls.admin_origin_save()) + cy.visit(this.Urls.admin_origin_save_requests()) .location('pathname') .should('be.equal', '/admin/login/'); cy.visit(this.Urls.admin_deposit()) @@ -131,7 +131,7 @@ beforeEach(function() { cy.adminLogin(); - cy.visit(this.Urls.admin_origin_save()); + cy.visit(this.Urls.admin_origin_save_requests()); cy.contains('a', 'Origin urls filtering') .click() @@ -237,7 +237,7 @@ // admin user logs in and visits save code now admin page cy.adminLogin(); - cy.visit(this.Urls.admin_origin_save()); + cy.visit(this.Urls.admin_origin_save_requests()); // admin rejects the save request and adds a rejection note cy.contains('#swh-origin-save-pending-requests', originUrl) @@ -279,7 +279,7 @@ // remove rejected request from swh-web database to avoid side effects // in tests located in origin-save.spec.js - cy.visit(this.Urls.admin_origin_save()); + cy.visit(this.Urls.admin_origin_save_requests()); cy.get('#swh-save-requests-rejected-tab') .click(); diff --git a/swh/web/admin/origin_save.py b/swh/web/admin/origin_save.py --- a/swh/web/admin/origin_save.py +++ b/swh/web/admin/origin_save.py @@ -26,10 +26,16 @@ ) -@admin_route(r"origin/save/", view_name="admin-origin-save") +@admin_route(r"origin/save/requests/", view_name="admin-origin-save-requests") @staff_member_required(view_func=None, login_url=settings.LOGIN_URL) -def _admin_origin_save(request): - return render(request, "admin/origin-save.html") +def _admin_origin_save_requests(request): + return render(request, "admin/origin-save/requests.html") + + +@admin_route(r"origin/save/filters/", view_name="admin-origin-save-filters") +@staff_member_required(view_func=None, login_url=settings.LOGIN_URL) +def _admin_origin_save_filters(request): + return render(request, "admin/origin-save/filters.html") def _datatables_origin_urls_response(request, urls_query_set): diff --git a/swh/web/admin/urls.py b/swh/web/admin/urls.py --- a/swh/web/admin/urls.py +++ b/swh/web/admin/urls.py @@ -18,7 +18,7 @@ def _admin_default_view(request): - return redirect("admin-origin-save") + return redirect("admin-origin-save-requests") urlpatterns = [ diff --git a/swh/web/templates/admin/origin-save/common.html b/swh/web/templates/admin/origin-save/common.html new file mode 100644 --- /dev/null +++ b/swh/web/templates/admin/origin-save/common.html @@ -0,0 +1,41 @@ +{% extends "layout.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 %} + +{% load swh_templatetags %} +{% load render_bundle from webpack_loader %} + +{% block header %} +{{ block.super }} +{% render_bundle 'admin' %} +{% render_bundle 'save' %} +{% endblock %} + +{% block title %} Save origin administration {% endblock %} + +{% block navbar-content %} +

Save origin administration

+{% endblock %} + +{% block content %} + + + +
+ {% block tab_content %} + {% endblock %} +
+ + +{% endblock %} diff --git a/swh/web/templates/admin/origin-save/filters.html b/swh/web/templates/admin/origin-save/filters.html new file mode 100644 --- /dev/null +++ b/swh/web/templates/admin/origin-save/filters.html @@ -0,0 +1,76 @@ +{% 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 %} +
+ + +
+
+ + + + + + +
Url
+
+
+
+ +
+ +
+
+
+
+ +
+
+
+
+
+ +
+ + + + + + +
Url
+
+
+
+ +
+ +
+
+
+
+ +
+
+
+
+
+
+
+{% endblock %} diff --git a/swh/web/templates/admin/origin-save.html b/swh/web/templates/admin/origin-save/requests.html rename from swh/web/templates/admin/origin-save.html rename to swh/web/templates/admin/origin-save/requests.html --- a/swh/web/templates/admin/origin-save.html +++ b/swh/web/templates/admin/origin-save/requests.html @@ -1,36 +1,14 @@ -{% extends "layout.html" %} +{% extends "./common.html" %} {% comment %} -Copyright (C) 2018-2021 The Software Heritage developers +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 %} -{% load swh_templatetags %} -{% load render_bundle from webpack_loader %} - -{% block header %} -{{ block.super }} -{% render_bundle 'admin' %} -{% render_bundle 'save' %} -{% endblock %} - -{% block title %} Save origin administration {% endblock %} - -{% block navbar-content %} -

Save origin administration

-{% endblock %} - -{% block content %} - - - -
+{% block tab_content %}
- -
- - -
-
- - - - - - -
Url
-
-
-
- -
- -
-
-
-
- -
-
-
-
-
- -
- - - - - - -
Url
-
-
-
- -
- -
-
-
-
- -
-
-
-
-
-
-
- - - {% endblock %} diff --git a/swh/web/templates/layout.html b/swh/web/templates/layout.html --- a/swh/web/templates/layout.html +++ b/swh/web/templates/layout.html @@ -227,7 +227,7 @@ {% if user.is_staff %}