diff --git a/MANIFEST.in b/MANIFEST.in --- a/MANIFEST.in +++ b/MANIFEST.in @@ -6,7 +6,8 @@ recursive-include swh py.typed recursive-include assets * -recursive-include swh/web/templates * +recursive-include swh/web/*/templates * +recursive-include swh/web/*/assets * recursive-include swh/web/tests/resources * recursive-include swh/web/tests/inbound_email/resources *.eml diff --git a/assets/config/webpack.config.development.js b/assets/config/webpack.config.development.js --- a/assets/config/webpack.config.development.js +++ b/assets/config/webpack.config.development.js @@ -1,5 +1,5 @@ /** - * 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 @@ -34,11 +34,27 @@ const nodeModules = path.resolve(__dirname, '../../node_modules/'); -// collect all bundles we want to produce with webpack +// collect all bundles we want to produce with webpack, +// bundles will be generated by scanning swh-web django applications: +// * if swh/web//assets/index.js exists, bundle is generated +// * if swh/web//assets//index.js exists, bundle is generated var bundles = {}; -const bundlesDir = path.join(__dirname, '../src/bundles'); -fs.readdirSync(bundlesDir).forEach(file => { - bundles[file] = ['bundles/' + file + '/index.js']; +const appsDir = path.join(__dirname, '../../swh/web'); +fs.readdirSync(appsDir).forEach(app => { + const appAssetsDir = path.join(appsDir, app, 'assets'); + if (fs.existsSync(appAssetsDir)) { + const appAssetsIndex = path.join(appAssetsDir, 'index.js'); + if (fs.existsSync(appAssetsIndex)) { + bundles[app] = [path.join(app, 'assets', 'index.js')]; + } else { + fs.readdirSync(appAssetsDir).forEach(appBundle => { + const appBundleIndex = path.join(appAssetsDir, appBundle, 'index.js'); + if (fs.existsSync(appBundleIndex)) { + bundles[appBundle] = [path.join(app, 'assets', appBundle, 'index.js')]; + } + }); + } + } }); // common loaders for css related assets (css, sass) @@ -126,7 +142,7 @@ watchFiles: { paths: ['assets/**/*', 'static/**/*', 'swh/web/**/*'], options: { - ignored: /.*.sqlite3/ + ignored: /.*.sqlite3.*/ } } }, @@ -152,7 +168,8 @@ // configure base paths for resolving modules with webpack modules: [ 'node_modules', - path.resolve(__dirname, '../src') + path.resolve(__dirname, '../src'), + path.resolve(__dirname, '../../swh/web') ] }, stats: 'errors-warnings', diff --git a/assets/src/bundles/add_forge/add-request-history-item.ejs b/assets/src/bundles/add_forge/add-request-history-item.ejs deleted file mode 100644 --- a/assets/src/bundles/add_forge/add-request-history-item.ejs +++ /dev/null @@ -1,36 +0,0 @@ -<%# - Copyright (C) 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 -%> -
-
-
-

- -

-
-
-
- <%if (event.text) { %> -
<%= event.text %>
- <% } %> - <%if (event.message_source_url !== null) { %> -

Open original message in email client

- <% } %> - <%if (event.new_status !== null) { %> -

- Status changed to: <%= swh.add_forge.formatRequestStatusName(event.new_status) %> -

- <% } %> -
-
-
-
diff --git a/assets/src/bundles/save/artifact-form-row.ejs b/assets/src/bundles/save/artifact-form-row.ejs deleted file mode 100644 --- a/assets/src/bundles/save/artifact-form-row.ejs +++ /dev/null @@ -1,34 +0,0 @@ -<%# - Copyright (C) 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 -%> - -
-
- - -
The artifact url is mandatory
-
-
- - -
The artifact version is mandatory
-
-
- <% if (deletableRow) { %> - - - <% } else { %> - - - <% } %> -
-
\ No newline at end of file diff --git a/cypress/e2e/origin-save.cy.js b/cypress/e2e/origin-save.cy.js --- a/cypress/e2e/origin-save.cy.js +++ b/cypress/e2e/origin-save.cy.js @@ -134,7 +134,7 @@ ]; cy.window().then(win => { inputValues.forEach(function(input, index, array) { - const actualValue = win.swh.save.formatValuePerType(input.type, input.value); + const actualValue = win.swh.save_code_now.formatValuePerType(input.type, input.value); assert.equal(actualValue, input.expectedValue); }); }); diff --git a/assets/src/bundles/add_forge/add-forge.css b/swh/web/add_forge_now/assets/add-forge.css rename from assets/src/bundles/add_forge/add-forge.css rename to swh/web/add_forge_now/assets/add-forge.css diff --git a/swh/web/add_forge_now/assets/add-request-history-item.ejs b/swh/web/add_forge_now/assets/add-request-history-item.ejs new file mode 100644 --- /dev/null +++ b/swh/web/add_forge_now/assets/add-request-history-item.ejs @@ -0,0 +1,36 @@ +<%# + Copyright (C) 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 +%> +
+
+
+

+ +

+
+
+
+ <%if (event.text) { %> +
<%= event.text %>
+ <% } %> + <%if (event.message_source_url !== null) { %> +

Open original message in email client

+ <% } %> + <%if (event.new_status !== null) { %> +

+ Status changed to: <%= swh.add_forge_now.formatRequestStatusName(event.new_status) %> +

+ <% } %> +
+
+
+
diff --git a/assets/src/bundles/add_forge/create-request.js b/swh/web/add_forge_now/assets/create-request.js rename from assets/src/bundles/add_forge/create-request.js rename to swh/web/add_forge_now/assets/create-request.js --- a/assets/src/bundles/add_forge/create-request.js +++ b/swh/web/add_forge_now/assets/create-request.js @@ -117,7 +117,7 @@ data: 'status', name: 'status', render: function(data, type, row, meta) { - return swh.add_forge.formatRequestStatusName(data); + return swh.add_forge_now.formatRequestStatusName(data); } } ], diff --git a/assets/src/bundles/add_forge/forge-admin-email.ejs b/swh/web/add_forge_now/assets/forge-admin-email.ejs rename from assets/src/bundles/add_forge/forge-admin-email.ejs rename to swh/web/add_forge_now/assets/forge-admin-email.ejs diff --git a/assets/src/bundles/add_forge/index.js b/swh/web/add_forge_now/assets/index.js rename from assets/src/bundles/add_forge/index.js rename to swh/web/add_forge_now/assets/index.js diff --git a/assets/src/bundles/add_forge/moderation-dashboard.js b/swh/web/add_forge_now/assets/moderation-dashboard.js rename from assets/src/bundles/add_forge/moderation-dashboard.js rename to swh/web/add_forge_now/assets/moderation-dashboard.js --- a/assets/src/bundles/add_forge/moderation-dashboard.js +++ b/swh/web/add_forge_now/assets/moderation-dashboard.js @@ -66,7 +66,7 @@ data: 'status', name: 'status', render: function(data, type, row, meta) { - return swh.add_forge.formatRequestStatusName(data); + return swh.add_forge_now.formatRequestStatusName(data); } } ], diff --git a/assets/src/bundles/add_forge/request-dashboard.js b/swh/web/add_forge_now/assets/request-dashboard.js rename from assets/src/bundles/add_forge/request-dashboard.js rename to swh/web/add_forge_now/assets/request-dashboard.js --- a/assets/src/bundles/add_forge/request-dashboard.js +++ b/swh/web/add_forge_now/assets/request-dashboard.js @@ -46,7 +46,7 @@ const data = await response.json(); forgeRequest = data.request; - $('#requestStatus').text(swh.add_forge.formatRequestStatusName(forgeRequest.status)); + $('#requestStatus').text(swh.add_forge_now.formatRequestStatusName(forgeRequest.status)); $('#requestType').text(forgeRequest.forge_type); $('#requestURL').text(forgeRequest.forge_url); $('#requestContactName').text(forgeRequest.forge_contact_name); @@ -93,7 +93,7 @@ function addStatusOption(status, index) { // Push the next possible status options - const label = swh.add_forge.formatRequestStatusName(status); + const label = swh.add_forge_now.formatRequestStatusName(status); $('#decisionOptions').append( `` ); diff --git a/swh/web/add_forge_now/templates/add-forge-common.html b/swh/web/add_forge_now/templates/add-forge-common.html --- a/swh/web/add_forge_now/templates/add-forge-common.html +++ b/swh/web/add_forge_now/templates/add-forge-common.html @@ -11,7 +11,7 @@ {% load static %} {% block header %} -{% render_bundle 'add_forge' %} +{% render_bundle 'add_forge_now' %} {% endblock %} {% block title %} @@ -66,7 +66,7 @@ {% endblock %} diff --git a/swh/web/add_forge_now/templates/add-forge-creation-form.html b/swh/web/add_forge_now/templates/add-forge-creation-form.html --- a/swh/web/add_forge_now/templates/add-forge-creation-form.html +++ b/swh/web/add_forge_now/templates/add-forge-creation-form.html @@ -45,7 +45,7 @@ Forge URL + name="forge_url" oninput="swh.add_forge_now.validateForgeUrl(this)" required> Remote URL of the forge. diff --git a/swh/web/add_forge_now/templates/add-forge-request-dashboard.html b/swh/web/add_forge_now/templates/add-forge-request-dashboard.html --- a/swh/web/add_forge_now/templates/add-forge-request-dashboard.html +++ b/swh/web/add_forge_now/templates/add-forge-request-dashboard.html @@ -12,7 +12,7 @@ {% load swh_templatetags %} {% block header %} -{% render_bundle 'add_forge' %} +{% render_bundle 'add_forge_now' %} {% endblock %} {% block title %}{{heading}} – Software Heritage archive{% endblock %} @@ -117,6 +117,6 @@ {% endblock %} diff --git a/swh/web/add_forge_now/templates/add-forge-requests-moderation.html b/swh/web/add_forge_now/templates/add-forge-requests-moderation.html --- a/swh/web/add_forge_now/templates/add-forge-requests-moderation.html +++ b/swh/web/add_forge_now/templates/add-forge-requests-moderation.html @@ -11,7 +11,7 @@ {% load static %} {% block header %} -{% render_bundle 'add_forge' %} +{% render_bundle 'add_forge_now' %} {% endblock %} {% block title %}{{ heading }} – Software Heritage archive{% endblock %} @@ -42,7 +42,7 @@ {% endblock %} diff --git a/assets/src/bundles/auth/auth.css b/swh/web/auth/assets/auth.css rename from assets/src/bundles/auth/auth.css rename to swh/web/auth/assets/auth.css diff --git a/assets/src/bundles/auth/index.js b/swh/web/auth/assets/index.js rename from assets/src/bundles/auth/index.js rename to swh/web/auth/assets/index.js diff --git a/assets/src/bundles/browse/breadcrumbs.css b/swh/web/browse/assets/browse/breadcrumbs.css rename from assets/src/bundles/browse/breadcrumbs.css rename to swh/web/browse/assets/browse/breadcrumbs.css diff --git a/assets/src/bundles/browse/browse-utils.js b/swh/web/browse/assets/browse/browse-utils.js rename from assets/src/bundles/browse/browse-utils.js rename to swh/web/browse/assets/browse/browse-utils.js diff --git a/assets/src/bundles/browse/browse.css b/swh/web/browse/assets/browse/browse.css rename from assets/src/bundles/browse/browse.css rename to swh/web/browse/assets/browse/browse.css diff --git a/assets/src/bundles/browse/content.css b/swh/web/browse/assets/browse/content.css rename from assets/src/bundles/browse/content.css rename to swh/web/browse/assets/browse/content.css diff --git a/assets/src/bundles/browse/iframe.js b/swh/web/browse/assets/browse/iframe.js rename from assets/src/bundles/browse/iframe.js rename to swh/web/browse/assets/browse/iframe.js diff --git a/assets/src/bundles/browse/index.js b/swh/web/browse/assets/browse/index.js rename from assets/src/bundles/browse/index.js rename to swh/web/browse/assets/browse/index.js diff --git a/assets/src/bundles/browse/origin-search.js b/swh/web/browse/assets/browse/origin-search.js rename from assets/src/bundles/browse/origin-search.js rename to swh/web/browse/assets/browse/origin-search.js diff --git a/assets/src/bundles/browse/snapshot-navigation.css b/swh/web/browse/assets/browse/snapshot-navigation.css rename from assets/src/bundles/browse/snapshot-navigation.css rename to swh/web/browse/assets/browse/snapshot-navigation.css diff --git a/assets/src/bundles/browse/snapshot-navigation.js b/swh/web/browse/assets/browse/snapshot-navigation.js rename from assets/src/bundles/browse/snapshot-navigation.js rename to swh/web/browse/assets/browse/snapshot-navigation.js diff --git a/assets/src/bundles/browse/swhid-utils.js b/swh/web/browse/assets/browse/swhid-utils.js rename from assets/src/bundles/browse/swhid-utils.js rename to swh/web/browse/assets/browse/swhid-utils.js diff --git a/assets/src/bundles/guided_tour/guided-tour-steps.yaml b/swh/web/browse/assets/guided_tour/guided-tour-steps.yaml rename from assets/src/bundles/guided_tour/guided-tour-steps.yaml rename to swh/web/browse/assets/guided_tour/guided-tour-steps.yaml diff --git a/assets/src/bundles/guided_tour/index.js b/swh/web/browse/assets/guided_tour/index.js rename from assets/src/bundles/guided_tour/index.js rename to swh/web/browse/assets/guided_tour/index.js diff --git a/assets/src/bundles/guided_tour/swh-introjs.css b/swh/web/browse/assets/guided_tour/swh-introjs.css rename from assets/src/bundles/guided_tour/swh-introjs.css rename to swh/web/browse/assets/guided_tour/swh-introjs.css diff --git a/assets/src/bundles/origin/index.js b/swh/web/browse/assets/origin_visits/index.js rename from assets/src/bundles/origin/index.js rename to swh/web/browse/assets/origin_visits/index.js diff --git a/assets/src/bundles/origin/utils.js b/swh/web/browse/assets/origin_visits/utils.js rename from assets/src/bundles/origin/utils.js rename to swh/web/browse/assets/origin_visits/utils.js diff --git a/assets/src/bundles/origin/visits-calendar.js b/swh/web/browse/assets/origin_visits/visits-calendar.js rename from assets/src/bundles/origin/visits-calendar.js rename to swh/web/browse/assets/origin_visits/visits-calendar.js diff --git a/assets/src/bundles/origin/visits-histogram.js b/swh/web/browse/assets/origin_visits/visits-histogram.js rename from assets/src/bundles/origin/visits-histogram.js rename to swh/web/browse/assets/origin_visits/visits-histogram.js diff --git a/assets/src/bundles/origin/visits-reporting.css b/swh/web/browse/assets/origin_visits/visits-reporting.css rename from assets/src/bundles/origin/visits-reporting.css rename to swh/web/browse/assets/origin_visits/visits-reporting.css diff --git a/assets/src/bundles/origin/visits-reporting.js b/swh/web/browse/assets/origin_visits/visits-reporting.js rename from assets/src/bundles/origin/visits-reporting.js rename to swh/web/browse/assets/origin_visits/visits-reporting.js diff --git a/assets/src/bundles/revision/diff-panel.ejs b/swh/web/browse/assets/revision/diff-panel.ejs rename from assets/src/bundles/revision/diff-panel.ejs rename to swh/web/browse/assets/revision/diff-panel.ejs diff --git a/assets/src/bundles/revision/diff-utils.js b/swh/web/browse/assets/revision/diff-utils.js rename from assets/src/bundles/revision/diff-utils.js rename to swh/web/browse/assets/revision/diff-utils.js diff --git a/assets/src/bundles/revision/index.js b/swh/web/browse/assets/revision/index.js rename from assets/src/bundles/revision/index.js rename to swh/web/browse/assets/revision/index.js diff --git a/assets/src/bundles/revision/log-utils.js b/swh/web/browse/assets/revision/log-utils.js rename from assets/src/bundles/revision/log-utils.js rename to swh/web/browse/assets/revision/log-utils.js diff --git a/assets/src/bundles/revision/revision.css b/swh/web/browse/assets/revision/revision.css rename from assets/src/bundles/revision/revision.css rename to swh/web/browse/assets/revision/revision.css diff --git a/swh/web/browse/templates/browse-origin-visits.html b/swh/web/browse/templates/browse-origin-visits.html --- a/swh/web/browse/templates/browse-origin-visits.html +++ b/swh/web/browse/templates/browse-origin-visits.html @@ -13,7 +13,7 @@ {% block header %} {{ block.super }} -{% render_bundle 'origin' %} +{% render_bundle 'origin_visits' %} {% endblock %} {% block swh-browse-content %} @@ -48,7 +48,7 @@ @@ -56,7 +56,7 @@ @@ -64,7 +64,7 @@ @@ -87,6 +87,6 @@ {% endblock %} diff --git a/swh/web/browse/templates/browse.html b/swh/web/browse/templates/browse.html --- a/swh/web/browse/templates/browse.html +++ b/swh/web/browse/templates/browse.html @@ -15,7 +15,7 @@ {% block header %} {% render_bundle 'browse' %} {% render_bundle 'vault' %} -{% render_bundle 'save' %} +{% render_bundle 'save_code_now' %} {% endblock %} {% block navbar-content %} diff --git a/swh/web/browse/templates/includes/take-new-snapshot.html b/swh/web/browse/templates/includes/take-new-snapshot.html --- a/swh/web/browse/templates/includes/take-new-snapshot.html +++ b/swh/web/browse/templates/includes/take-new-snapshot.html @@ -1,5 +1,5 @@ {% comment %} -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 @@ -67,7 +67,7 @@ diff --git a/assets/src/bundles/admin/deposit.js b/swh/web/deposit/assets/index.js rename from assets/src/bundles/admin/deposit.js rename to swh/web/deposit/assets/index.js diff --git a/swh/web/deposit/templates/deposit-admin.html b/swh/web/deposit/templates/deposit-admin.html --- a/swh/web/deposit/templates/deposit-admin.html +++ b/swh/web/deposit/templates/deposit-admin.html @@ -1,7 +1,7 @@ {% extends "layout.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 @@ -12,7 +12,7 @@ {% block header %} {{ block.super }} -{% render_bundle 'admin' %} +{% render_bundle 'deposit' %} {% endblock %} {% block title %} Deposit administration {% endblock %} @@ -58,6 +58,6 @@

{% endblock content %} diff --git a/assets/src/bundles/admin/mailmap.js b/swh/web/mailmap/assets/index.js rename from assets/src/bundles/admin/mailmap.js rename to swh/web/mailmap/assets/index.js --- a/assets/src/bundles/admin/mailmap.js +++ b/swh/web/mailmap/assets/index.js @@ -140,7 +140,7 @@ render: (data, type, row) => { const html = ``; return html; diff --git a/assets/src/bundles/admin/mailmap-form.ejs b/swh/web/mailmap/assets/mailmap-form.ejs rename from assets/src/bundles/admin/mailmap-form.ejs rename to swh/web/mailmap/assets/mailmap-form.ejs diff --git a/swh/web/mailmap/templates/admin/mailmap.html b/swh/web/mailmap/templates/admin/mailmap.html --- a/swh/web/mailmap/templates/admin/mailmap.html +++ b/swh/web/mailmap/templates/admin/mailmap.html @@ -12,7 +12,7 @@ {% block header %} {{ block.super }} -{% render_bundle 'admin' %} +{% render_bundle 'mailmap' %} {% endblock %} {% block title %} Mailmap administration – Software Heritage archive {% endblock %} @@ -27,7 +27,7 @@ on their emails.

-
@@ -49,6 +49,6 @@ {% endblock content %} diff --git a/swh/web/save_code_now/assets/artifact-form-row.ejs b/swh/web/save_code_now/assets/artifact-form-row.ejs new file mode 100644 --- /dev/null +++ b/swh/web/save_code_now/assets/artifact-form-row.ejs @@ -0,0 +1,31 @@ +<%# Copyright (C) 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 %> + +
+
+ + +
The artifact url is mandatory
+
+
+ + +
The artifact version is mandatory
+
+
+ <% if (deletableRow) { %> + + + <% } else { %> + + + <% } %> +
+
\ No newline at end of file diff --git a/assets/src/bundles/admin/index.js b/swh/web/save_code_now/assets/index.js rename from assets/src/bundles/admin/index.js rename to swh/web/save_code_now/assets/index.js --- a/assets/src/bundles/admin/index.js +++ b/swh/web/save_code_now/assets/index.js @@ -1,10 +1,8 @@ -/** - * Copyright (C) 2018-2022 The Software Heritage developers +/* Copyright (C) 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 */ -export * from './deposit'; -export * from './mailmap'; export * from './origin-save'; +export * from './origin-save-admin'; diff --git a/assets/src/bundles/admin/origin-save.js b/swh/web/save_code_now/assets/origin-save-admin.js rename from assets/src/bundles/admin/origin-save.js rename to swh/web/save_code_now/assets/origin-save-admin.js --- a/assets/src/bundles/admin/origin-save.js +++ b/swh/web/save_code_now/assets/origin-save-admin.js @@ -5,9 +5,8 @@ * See top-level LICENSE file for more information */ -import {handleFetchError, csrfPost, htmlAlert, - getHumanReadableDate} from 'utils/functions'; import {swhSpinnerSrc} from 'utils/constants'; +import {csrfPost, getHumanReadableDate, handleFetchError, htmlAlert} from 'utils/functions'; let authorizedOriginTable; let unauthorizedOriginTable; @@ -124,7 +123,7 @@ row.note != null) { return ``; + onclick="swh.save_code_now.displaySaveRequestInfo(event, ${row.id})">`; } else { return ''; } diff --git a/assets/src/bundles/save/index.js b/swh/web/save_code_now/assets/origin-save.js rename from assets/src/bundles/save/index.js rename to swh/web/save_code_now/assets/origin-save.js --- a/assets/src/bundles/save/index.js +++ b/swh/web/save_code_now/assets/origin-save.js @@ -208,7 +208,7 @@ row.note != null) { return ``; + onclick="swh.save_code_now.displaySaveRequestInfo(event, ${row.id})">`; } else { return ''; } @@ -219,7 +219,7 @@ if (row.save_request_status === 'accepted') { const saveAgainButton = ''; diff --git a/swh/web/save_code_now/templates/admin/origin-save-common.html b/swh/web/save_code_now/templates/admin/origin-save-common.html --- a/swh/web/save_code_now/templates/admin/origin-save-common.html +++ b/swh/web/save_code_now/templates/admin/origin-save-common.html @@ -12,8 +12,7 @@ {% block header %} {{ block.super }} -{% render_bundle 'admin' %} -{% render_bundle 'save' %} +{% render_bundle 'save_code_now' %} {% endblock %} {% block title %} Save origin administration {% endblock %} @@ -36,6 +35,6 @@ {% endblock %} diff --git a/swh/web/save_code_now/templates/admin/origin-save-filters.html b/swh/web/save_code_now/templates/admin/origin-save-filters.html --- a/swh/web/save_code_now/templates/admin/origin-save-filters.html +++ b/swh/web/save_code_now/templates/admin/origin-save-filters.html @@ -35,12 +35,12 @@
- +
- +
@@ -60,12 +60,12 @@
- +
- +
diff --git a/swh/web/save_code_now/templates/admin/origin-save-requests.html b/swh/web/save_code_now/templates/admin/origin-save-requests.html --- a/swh/web/save_code_now/templates/admin/origin-save-requests.html +++ b/swh/web/save_code_now/templates/admin/origin-save-requests.html @@ -37,13 +37,13 @@
- +
- +
- +
@@ -64,7 +64,7 @@
- +
@@ -84,7 +84,7 @@
- +
diff --git a/swh/web/save_code_now/templates/origin-save.html b/swh/web/save_code_now/templates/origin-save.html --- a/swh/web/save_code_now/templates/origin-save.html +++ b/swh/web/save_code_now/templates/origin-save.html @@ -1,7 +1,7 @@ {% extends "layout.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 @@ -13,7 +13,7 @@ {% block title %}{{ heading }} – Software Heritage archive{% endblock %} {% block header %} -{% render_bundle 'save' %} +{% render_bundle 'save_code_now' %} {% endblock %} {% block navbar-content %} @@ -33,7 +33,7 @@
- {% for visit_type in visit_types %} {% endfor %} @@ -42,7 +42,7 @@
- +
The origin url is not valid or does not reference a code repository
@@ -82,7 +82,7 @@ {% endblock %} diff --git a/swh/web/tests/conftest.py b/swh/web/tests/conftest.py --- a/swh/web/tests/conftest.py +++ b/swh/web/tests/conftest.py @@ -128,12 +128,27 @@ if os.path.exists(webpack_stats): return - bundles_dir = os.path.join(test_dir, "../../../assets/src/bundles") - if not os.path.exists(bundles_dir): - # location of the bundles folder when running tests with tox - bundles_dir = os.path.join(data_dir, "assets/src/bundles") - - _, bundles, _ = next(os.walk(bundles_dir)) + django_apps_dir = os.path.join(test_dir, "../../../swh/web") + if not os.path.exists(django_apps_dir): + # location of the applications folder when running tests with tox + django_apps_dir = os.path.join(data_dir, "swh/web") + + bundles = [] + _, apps, _ = next(os.walk(django_apps_dir)) + for app in apps: + app_assets_dir = os.path.join(django_apps_dir, app, "assets") + if os.path.exists(app_assets_dir): + if os.path.exists(os.path.join(app_assets_dir, "index.js")): + bundles.append(app) + else: + _, app_bundles, _ = next(os.walk(app_assets_dir)) + for app_bundle in app_bundles: + if os.path.exists( + os.path.join(app_assets_dir, app_bundle, "index.js") + ): + bundles.append(app_bundle) + + print(bundles) mock_webpack_stats = { "status": "done", diff --git a/assets/src/bundles/vault/index.js b/swh/web/vault/assets/index.js rename from assets/src/bundles/vault/index.js rename to swh/web/vault/assets/index.js diff --git a/assets/src/bundles/vault/vault-create-tasks.js b/swh/web/vault/assets/vault-create-tasks.js rename from assets/src/bundles/vault/vault-create-tasks.js rename to swh/web/vault/assets/vault-create-tasks.js diff --git a/assets/src/bundles/vault/vault-table-row.ejs b/swh/web/vault/assets/vault-table-row.ejs rename from assets/src/bundles/vault/vault-table-row.ejs rename to swh/web/vault/assets/vault-table-row.ejs diff --git a/assets/src/bundles/vault/vault-ui.js b/swh/web/vault/assets/vault-ui.js rename from assets/src/bundles/vault/vault-ui.js rename to swh/web/vault/assets/vault-ui.js diff --git a/assets/src/bundles/vault/vault.css b/swh/web/vault/assets/vault.css rename from assets/src/bundles/vault/vault.css rename to swh/web/vault/assets/vault.css diff --git a/swh/web/vault/templates/vault-ui.html b/swh/web/vault/templates/vault-ui.html --- a/swh/web/vault/templates/vault-ui.html +++ b/swh/web/vault/templates/vault-ui.html @@ -7,8 +7,6 @@ See top-level LICENSE file for more information {% endcomment %} -{% load render_bundle from webpack_loader %} - {% block navbar-content %}

Download archived software

{% endblock %} diff --git a/assets/src/bundles/vendors/datatables.css b/swh/web/webapp/assets/vendors/datatables.css rename from assets/src/bundles/vendors/datatables.css rename to swh/web/webapp/assets/vendors/datatables.css diff --git a/assets/src/bundles/vendors/elementsfrompoint-polyfill.js b/swh/web/webapp/assets/vendors/elementsfrompoint-polyfill.js rename from assets/src/bundles/vendors/elementsfrompoint-polyfill.js rename to swh/web/webapp/assets/vendors/elementsfrompoint-polyfill.js diff --git a/assets/src/bundles/vendors/index.js b/swh/web/webapp/assets/vendors/index.js rename from assets/src/bundles/vendors/index.js rename to swh/web/webapp/assets/vendors/index.js diff --git a/assets/src/bundles/webapp/badges.js b/swh/web/webapp/assets/webapp/badges.js rename from assets/src/bundles/webapp/badges.js rename to swh/web/webapp/assets/webapp/badges.js diff --git a/assets/src/bundles/webapp/breadcrumbs.css b/swh/web/webapp/assets/webapp/breadcrumbs.css rename from assets/src/bundles/webapp/breadcrumbs.css rename to swh/web/webapp/assets/webapp/breadcrumbs.css diff --git a/assets/src/bundles/webapp/code-highlighting.js b/swh/web/webapp/assets/webapp/code-highlighting.js rename from assets/src/bundles/webapp/code-highlighting.js rename to swh/web/webapp/assets/webapp/code-highlighting.js diff --git a/assets/src/bundles/webapp/coverage.css b/swh/web/webapp/assets/webapp/coverage.css rename from assets/src/bundles/webapp/coverage.css rename to swh/web/webapp/assets/webapp/coverage.css diff --git a/assets/src/bundles/webapp/history-counters.css b/swh/web/webapp/assets/webapp/history-counters.css rename from assets/src/bundles/webapp/history-counters.css rename to swh/web/webapp/assets/webapp/history-counters.css diff --git a/assets/src/bundles/webapp/history-counters.js b/swh/web/webapp/assets/webapp/history-counters.js rename from assets/src/bundles/webapp/history-counters.js rename to swh/web/webapp/assets/webapp/history-counters.js diff --git a/assets/src/bundles/webapp/index.js b/swh/web/webapp/assets/webapp/index.js rename from assets/src/bundles/webapp/index.js rename to swh/web/webapp/assets/webapp/index.js diff --git a/assets/src/bundles/webapp/math-typesetting.js b/swh/web/webapp/assets/webapp/math-typesetting.js rename from assets/src/bundles/webapp/math-typesetting.js rename to swh/web/webapp/assets/webapp/math-typesetting.js diff --git a/assets/src/bundles/webapp/notebook-rendering.js b/swh/web/webapp/assets/webapp/notebook-rendering.js rename from assets/src/bundles/webapp/notebook-rendering.js rename to swh/web/webapp/assets/webapp/notebook-rendering.js diff --git a/assets/src/bundles/webapp/notebook.css b/swh/web/webapp/assets/webapp/notebook.css rename from assets/src/bundles/webapp/notebook.css rename to swh/web/webapp/assets/webapp/notebook.css diff --git a/assets/src/bundles/webapp/pdf-rendering.js b/swh/web/webapp/assets/webapp/pdf-rendering.js rename from assets/src/bundles/webapp/pdf-rendering.js rename to swh/web/webapp/assets/webapp/pdf-rendering.js diff --git a/assets/src/bundles/webapp/readme-rendering.js b/swh/web/webapp/assets/webapp/readme-rendering.js rename from assets/src/bundles/webapp/readme-rendering.js rename to swh/web/webapp/assets/webapp/readme-rendering.js diff --git a/assets/src/bundles/webapp/sentry.js b/swh/web/webapp/assets/webapp/sentry.js rename from assets/src/bundles/webapp/sentry.js rename to swh/web/webapp/assets/webapp/sentry.js diff --git a/assets/src/bundles/webapp/status-widget.css b/swh/web/webapp/assets/webapp/status-widget.css rename from assets/src/bundles/webapp/status-widget.css rename to swh/web/webapp/assets/webapp/status-widget.css diff --git a/assets/src/bundles/webapp/status-widget.js b/swh/web/webapp/assets/webapp/status-widget.js rename from assets/src/bundles/webapp/status-widget.js rename to swh/web/webapp/assets/webapp/status-widget.js diff --git a/assets/src/bundles/webapp/webapp-utils.js b/swh/web/webapp/assets/webapp/webapp-utils.js rename from assets/src/bundles/webapp/webapp-utils.js rename to swh/web/webapp/assets/webapp/webapp-utils.js diff --git a/assets/src/bundles/webapp/webapp.css b/swh/web/webapp/assets/webapp/webapp.css rename from assets/src/bundles/webapp/webapp.css rename to swh/web/webapp/assets/webapp/webapp.css diff --git a/assets/src/bundles/webapp/xss-filtering.js b/swh/web/webapp/assets/webapp/xss-filtering.js rename from assets/src/bundles/webapp/xss-filtering.js rename to swh/web/webapp/assets/webapp/xss-filtering.js