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 @@ -49,7 +49,7 @@ // Read the actual selected value and depending on the origin type, display some extra // inputs or hide them. const originType = $('#swh-input-visit-type').val(); - const display = originType === 'bundle' ? 'flex' : 'none'; + const display = originType === 'archives' ? 'flex' : 'none'; $('#optional-origin-forms').css('display', display); } @@ -242,8 +242,8 @@ let originType = $('#swh-input-visit-type').val(); let originUrl = $('#swh-input-origin-url').val(); - // read the extra inputs for the bundle type - let extraData = originType !== 'bundle' ? {} : { + // read the extra inputs for the 'archives' type + let extraData = originType !== 'archives' ? {} : { 'artifact_url': $('#swh-input-artifact-url').val(), 'artifact_filename': $('#swh-input-artifact-filename').val(), 'artifact_version': $('#swh-input-artifact-version').val() 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 @@ -20,7 +20,7 @@ }; const anonymousVisitTypes = ['git', 'hg', 'svn']; -const allVisitTypes = ['bundle', 'git', 'hg', 'svn']; +const allVisitTypes = ['archives', 'git', 'hg', 'svn']; function makeOriginSaveRequest(originType, originUrl) { cy.get('#swh-input-origin-url') @@ -501,7 +501,7 @@ }); }); - it('should display extra inputs when dealing with bundle visit type', function() { + it('should display extra inputs when dealing with \'archives\' visit type', function() { cy.ambassadorLogin(); cy.visit(url); @@ -510,19 +510,19 @@ cy.get('#optional-origin-forms').should('not.be.visible'); } - // bundle should display more inputs with the bundle type - cy.get('#swh-input-visit-type').select('bundle'); + // this should display more inputs with the 'archives' type + cy.get('#swh-input-visit-type').select('archives'); cy.get('#optional-origin-forms').should('be.visible'); }); - it('should be allowed to submit bundle save request when connected as ambassador', function() { + it('should be allowed to submit \'archives\' save request when connected as ambassador', function() { let originUrl = 'https://ftp.gnu.org/pub/pub/gnu/3dldf'; let artifactUrl = 'https://ftp.gnu.org/pub/pub/gnu/3dldf/3DLDF-1.1.4.tar.gz'; let artifactFilename = '3DLDF-1.1.4.tar.gz'; let artifactVersion = '1.1.4'; stubSaveRequest({ - requestUrl: this.Urls.api_1_save_origin('bundle', originUrl), + requestUrl: this.Urls.api_1_save_origin('archives', originUrl), saveRequestStatus: 'accepted', originUrl: originUrl, saveTaskStatus: 'not yet scheduled' @@ -531,11 +531,11 @@ cy.ambassadorLogin(); cy.visit(url); - // input new bundle information and submit + // input new 'archives' information and submit cy.get('#swh-input-origin-url') .type(originUrl) .get('#swh-input-visit-type') - .select('bundle') + .select('archives') .get('#swh-input-artifact-url') .type(artifactUrl) .get('#swh-input-artifact-filename') diff --git a/swh/web/auth/utils.py b/swh/web/auth/utils.py --- a/swh/web/auth/utils.py +++ b/swh/web/auth/utils.py @@ -1,4 +1,4 @@ -# Copyright (C) 2020 The Software Heritage developers +# Copyright (C) 2020-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 @@ -75,7 +75,7 @@ def privileged_user(request) -> bool: """Determine whether a user is authenticated and is a privileged one (e.g ambassador). This allows such user to have access to some more actions (e.g. bypass save code now - review, access to 'bundle' type...) + review, access to 'archives' type...) """ return request.user.is_authenticated and request.user.has_perm( diff --git a/swh/web/common/origin_save.py b/swh/web/common/origin_save.py --- a/swh/web/common/origin_save.py +++ b/swh/web/common/origin_save.py @@ -114,7 +114,7 @@ _visit_type_task = {"git": "load-git", "hg": "load-hg", "svn": "load-svn"} _visit_type_task_privileged = { - "bundle": "load-archive-files", + "archives": "load-archive-files", } @@ -388,15 +388,16 @@ swh-scheduler component. First, some checks are performed to see if the visit type and origin url are valid - but also if the the save request can be accepted. For the 'bundle' visit type, this - also ensures the artifacts actually exists. If those checks passed, the loading task - is then created. Otherwise, the save request is put in pending or rejected state. + but also if the the save request can be accepted. For the 'archives' visit type, + this also ensures the artifacts actually exists. If those checks passed, the loading + task is then created. Otherwise, the save request is put in pending or rejected + state. All the submitted save requests are logged into the swh-web database to keep track of them. Args: - visit_type: the type of visit to perform (e.g. git, hg, svn, bundle, ...) + visit_type: the type of visit to perform (e.g. git, hg, svn, archives, ...) origin_url: the url of the origin to save privileged: Whether the user has some more privilege than other (bypass review, access to privileged other visit types) @@ -426,7 +427,7 @@ _check_origin_url_valid(origin_url) artifact_url = kwargs.get("artifact_url") - if visit_type == "bundle": + if visit_type == "archives": metadata = _check_origin_exists(artifact_url) # if all checks passed so far, we can try and save the origin @@ -441,7 +442,7 @@ "priority": "high", "url": origin_url, } - if visit_type == "bundle": + if visit_type == "archives": # extra arguments for that type are required assert metadata is not None task_kwargs = dict( 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 @@ -50,7 +50,7 @@ - +