diff --git a/cypress/integration/vault.spec.js b/cypress/integration/vault.spec.js --- a/cypress/integration/vault.spec.js +++ b/cypress/integration/vault.spec.js @@ -129,8 +129,7 @@ statusCode: 500 }).as('checkVaultCookingTask'); - cy.contains('button', 'Download') - .click(); + checkVaultCookingTask('as tarball'); // Check error alert is displayed cy.get('.alert-danger') @@ -157,6 +156,9 @@ cy.contains('button', 'Download') .click(); + cy.contains('button', 'as tarball') + .click(); + // Create a vault cooking task through the GUI cy.get('.modal-dialog') .contains('button:visible', 'Ok') @@ -229,6 +231,9 @@ cy.contains('button', 'Download') .click(); + cy.contains('button', 'as tarball') + .click(); + cy.window().then(win => { const swhIdsContext = win.swh.webapp.getSwhIdsContext(); const browseDirectoryUrl = swhIdsContext.directory.swhid_with_context_url; @@ -393,6 +398,9 @@ cy.contains('button', 'Download') .click(); + cy.contains('button', 'as tarball') + .click(); + // Create a vault cooking task through the GUI cy.get('.modal-dialog') .contains('button:visible', 'Ok') @@ -421,10 +429,7 @@ }).as('createVaultCookingTask'); // Open vault cook directory modal - cy.contains('button', 'Download') - .click(); - - cy.wait('@checkVaultCookingTask'); + checkVaultCookingTask('as tarball'); // Create a vault cooking task through the GUI and fill email input cy.get('#vault-cook-directory-modal input[type="email"]') @@ -518,6 +523,9 @@ cy.contains('button', 'Download') .click(); + cy.contains('button', 'as tarball') + .click(); + // Start archive download through the GUI cy.get('.modal-dialog') .contains('button:visible', 'Ok') @@ -571,6 +579,9 @@ cy.contains('button', 'Download') .click(); + cy.contains('button', 'as tarball') + .click(); + // Check that recooking the directory is offered to user cy.get('.modal-dialog') .contains('button:visible', 'Ok') diff --git a/swh/web/api/views/vault.py b/swh/web/api/views/vault.py --- a/swh/web/api/views/vault.py +++ b/swh/web/api/views/vault.py @@ -404,10 +404,10 @@ .. http:get:: /api/1/vault/git-bare/(swhid)/ .. http:post:: /api/1/vault/git-bare/(swhid)/ - Request the cooking of a git-bare archive for a revision or check - its cooking status. + Request the cooking of a git-bare archive for a revision/release + object, or check its cooking status. - That endpoint enables to create a vault cooking task for a revision + That endpoint enables to create a vault cooking task for an object through a POST request or check the status of a previously created one through a GET request. @@ -415,17 +415,18 @@ can be downloaded using the dedicated endpoint :http:get:`/api/1/vault/git-bare/(swhid)/raw/`. - Then to import the revision in the current directory, use:: + Then to import the object in the current directory, use:: $ tar -xf path/to/swh_1_rev_*.git.tar $ git clone swh:1:rev:*.git new_repository - (replace ``swh:1:rev:*`` with the SWHID of the requested revision) + (replace ``swh:1:rev:*`` with the SWHID of the requested object) This will create a directory called ``new_repository``, which is a git repository containing the requested objects. - :param string swhid: the revision's permanent identifier + :param string swhid: the object's permanent identifier, which should start + with ``swh:1:rev:`` or ``swh:1:rel:``. :query string email: e-mail to notify when the git-bare archive is ready @@ -441,12 +442,12 @@ :>json string swhid: the identifier of the object to cook :statuscode 200: no error - :statuscode 404: requested directory did not receive any cooking + :statuscode 404: requested object did not receive any cooking request yet (in case of GET) or can not be found in the archive (in case of POST) """ swhid = CoreSWHID.from_string(swhid) - if swhid.object_type == ObjectType.REVISION: + if swhid.object_type in (ObjectType.REVISION, ObjectType.RELEASE): res = _dispatch_cook_progress(request, "git_bare", swhid) res["fetch_url"] = reverse( "api-1-vault-fetch-git-bare", @@ -465,7 +466,9 @@ "Use `/api/1/vault/flat/` to cook directories, as flat bundles." ) else: - raise BadInputExc("Only revisions can be cooked as 'git-bare' bundles.") + raise BadInputExc( + "Only revisions and releases can be cooked as 'git-bare' bundles." + ) @api_route( diff --git a/swh/web/templates/includes/vault-create-tasks.html b/swh/web/templates/includes/vault-create-tasks.html --- a/swh/web/templates/includes/vault-create-tasks.html +++ b/swh/web/templates/includes/vault-create-tasks.html @@ -8,33 +8,26 @@ {% load swh_templatetags %} {% if vault_cooking %} - {% if user.is_authenticated and user.is_staff or "swh.vault.git_bare.ui" in user.get_all_permissions %} -
- - -
- {% else %} - - {% endif %} + +