Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

221 - Integration multiple files download #254

Merged

Conversation

MellyGray
Copy link
Contributor

@MellyGray MellyGray commented Dec 11, 2023

What this PR does / why we need it:

This PR adds the integration of the Download multiple files button in the Files Table with the dataverse API. With this integration the SPA user will be able to select multiple files from the dataset table and download them.

Which issue(s) this PR closes:

Special notes for your reviewer:

Suggestions on how to test this:

Step 1: Run the development environment

  1. Run npm I
  2. cd packages/design-system && npm run build
  3. cd ../../
  4. Check that you have a .env file such as the .env.example, with the VITE_DATAVERSE_BACKEND_URL=http://localhost:8000 variable
  5. cd dev-env
  6. ./run-env.sh unstable
  7. To check the environment go to http://localhost:8000 and check your local dataverse installation

Step 2: Test Dataset View mode with the implemented changes to download the files

  1. Go to http://localhost:8000
  2. Login as admin using username: dataverseAdmin and password: admin1
  3. Create a new Dataset
  4. Upload some files to the dataset
  5. From the dataset view mode copy the search parameters from the url. Ex.: ?persistentId=doi:10.5072/FK2/LHGRHP&version=DRAFT
  6. Go to http://localhost:8000/spa/datasets and paste the search parameters. Ex.: http://localhost:8000/spa/datasets?persistentId=doi:10.5072/FK2/LHGRHP&version=DRAFT
  7. You are currently viewing the same dataset in the SPA. In the files table, locate the "Download" button on the right of the Files Table. Select some files using the checkboxes and then click the Download button to download all of them at once.

Does this PR introduce a user interface change? If mockups are available, please link/include them here:

No

Is there a release notes update needed for this change?:

No

Additional documentation:

@MellyGray MellyGray added Size: 3 A percentage of a sprint. 2.1 hours. integration Tasks involving the connection and interaction of UI features with the Dataverse API labels Dec 11, 2023
@coveralls
Copy link

coveralls commented Dec 11, 2023

Coverage Status

coverage: 98.173% (-0.03%) from 98.205%
when pulling 66f2331 on feature/221-integration-files-table-row-selection-download
into 14a74ae on develop.

@MellyGray MellyGray marked this pull request as ready for review December 11, 2023 16:04
Base automatically changed from feature/238-integration-single-file-download to develop December 12, 2023 14:15
@GPortas GPortas self-assigned this Dec 13, 2023
@MellyGray MellyGray linked an issue Dec 13, 2023 that may be closed by this pull request
@GPortas
Copy link
Contributor

GPortas commented Dec 13, 2023

Can you please resolve conflicts? @MellyGray

…into feature/221-integration-files-table-row-selection-download
@MellyGray
Copy link
Contributor Author

@GPortas merge conflicts resolved

@MellyGray MellyGray removed their assignment Dec 14, 2023
Copy link
Contributor

@GPortas GPortas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Downloading multiple files works fine. The message saying that the zip download limit has been exceeded is confusing, although I understand that it appears because the integration of the zip limit setting is pending, and the limit (1B) is mocked, right?

On the other hand for downloading a single file, a zip should not be generated, and the file must be downloaded individually unzipped, as in JSF.

multfile.mov

@MellyGray
Copy link
Contributor Author

@GPortas

  1. I can increase the mock from 1B zip limit to something higher so it doesn't appear in beta
  2. I don't understand why is downloading 1 file as a zip, I saw this comment in JSF
// There's a chance that this is not really a batch download - i.e.,
 // there may only be one file on the downloadable list. But the fileDownloadService
 // method below will check for that, and will redirect to the single download, if
 // that's the case. -- L.A.
 fileDownloadService.writeGuestbookAndStartBatchDownload(guestbookResponse, doNotSaveGuestbookResponse);

If you look at the implementation if (fileIds.length == 1) { it calls redirectToDownloadAPI() for the single file download instead of settingsService.getValueForKey(SettingsServiceBean.Key.CustomZipDownloadServiceUrl); to get the zip. Is the API not using this same fileDownloadService than JSF?

I mean, I can handle it in the frontend and call the single download from the frontend, but isn't the desired API behavior to download a single file if only 1 file is selected? I want to be sure before applying the logic in the UI

@GPortas
Copy link
Contributor

GPortas commented Dec 14, 2023

@GPortas

  1. I can increase the mock from 1B zip limit to something higher so it doesn't appear in beta
  2. I don't understand why is downloading 1 file as a zip, I saw this comment in JSF
// There's a chance that this is not really a batch download - i.e.,
 // there may only be one file on the downloadable list. But the fileDownloadService
 // method below will check for that, and will redirect to the single download, if
 // that's the case. -- L.A.
 fileDownloadService.writeGuestbookAndStartBatchDownload(guestbookResponse, doNotSaveGuestbookResponse);

If you look at the implementation if (fileIds.length == 1) { it calls redirectToDownloadAPI() for the single file download instead of settingsService.getValueForKey(SettingsServiceBean.Key.CustomZipDownloadServiceUrl); to get the zip. Is the API not using this same fileDownloadService than JSF?

I mean, I can handle it in the frontend and call the single download from the frontend, but isn't the desired API behavior to download a single file if only 1 file is selected? I want to be sure before applying the logic in the UI

Is the API not using this same fileDownloadService than JSF? -> No. That logic is only consumed from the JSF UI Helper class.

We need to replicate the same logic on the SPA.

The /datafiles endpoint always create a zipped bundle. The /datafile endpoint returns an individual unzipped file.

@MellyGray MellyGray removed their assignment Dec 14, 2023
@MellyGray
Copy link
Contributor Author

@GPortas I applied the requested changes

@MellyGray MellyGray requested a review from GPortas December 14, 2023 17:22
Copy link
Contributor

@GPortas GPortas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@GPortas GPortas merged commit c3c00ce into develop Dec 15, 2023
10 of 12 checks passed
@GPortas GPortas deleted the feature/221-integration-files-table-row-selection-download branch December 15, 2023 10:01
jayanthkomarraju pushed a commit to jayanthkomarraju/dataverse-frontend that referenced this pull request May 31, 2024
…able-row-selection-download

221 - Integration multiple files download
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration Tasks involving the connection and interaction of UI features with the Dataverse API Size: 3 A percentage of a sprint. 2.1 hours.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Files Table row selection Download Button
3 participants