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

Preventing download of empty files #1195 #1232

Merged
merged 5 commits into from
May 4, 2022

Conversation

sam-glendenning
Copy link
Contributor

@sam-glendenning sam-glendenning commented Apr 22, 2022

Description

This requires passing the size of the relevant entity to the download button. In table and card view, we make use of the sizeQueries array for this, disabling the download button until we can confirm the entity size is greater than zero (realistically, this happens quickly enough that the user does not notice). If the button is disabled, the user can move their mouse over the button to show a tooltip explaining the file is empty and thus cannot be downloaded.

Testing instructions

This should be tested with SciGateway and both Dataview and Search. The download button appears as both a box and an icon in many places so it's important to test it enables and disables properly everywhere. If you're hooked up to the production IDS, you'll get a variety of empty and non-empty sets of data to properly test this. Make sure that every time the button is disabled, a tooltip displays over it. Also check to see how this all looks in light/dark mode and give any thoughts on that too if you have any.

  • Review code
  • Check Actions build
  • Review changes to test coverage

Agile board tracking

Closes #1195

Sam Glendenning added 2 commits April 22, 2022 14:02
…#1195

This involves passing the size of the relevant entity to the download button. In table and card view, this involves making use of the sizeQueries array. If the button is disabled, the user can move their mouse over the button to show a tooltip explaining the file is empty and thus cannot be downloaded.
@sam-glendenning sam-glendenning added bug Something isn't working datagateway-dataview Issues corresponding to the dataview component. This component supersedes datagateway-table labels Apr 22, 2022
@codecov
Copy link

codecov bot commented Apr 22, 2022

Codecov Report

Merging #1232 (5b8fb7c) into develop (3cb1ca2) will decrease coverage by 0.03%.
The diff coverage is 90.32%.

@@             Coverage Diff             @@
##           develop    #1232      +/-   ##
===========================================
- Coverage    97.51%   97.47%   -0.04%     
===========================================
  Files          133      133              
  Lines         6753     6785      +32     
  Branches      2000     2059      +59     
===========================================
+ Hits          6585     6614      +29     
- Misses         153      155       +2     
- Partials        15       16       +1     
Flag Coverage Δ
common 98.14% <100.00%> (+<0.01%) ⬆️
dataview 97.97% <90.90%> (-0.05%) ⬇️
download 94.85% <ø> (+0.04%) ⬆️
search 97.37% <50.00%> (-0.15%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...src/card/investigationSearchCardView.component.tsx 98.40% <33.33%> (-1.60%) ⬇️
...s/table/isis/isisInvestigationsTable.component.tsx 98.41% <50.00%> (-1.59%) ⬇️
...eway-common/src/views/downloadButton.component.tsx 100.00% <100.00%> (ø)
...views/card/isis/isisDatasetsCardView.component.tsx 97.95% <100.00%> (+0.04%) ⬆️
...card/isis/isisInvestigationsCardView.component.tsx 98.38% <100.00%> (+0.02%) ⬆️
...iews/landing/isis/isisDatasetLanding.component.tsx 100.00% <100.00%> (ø)
...anding/isis/isisInvestigationLanding.component.tsx 100.00% <100.00%> (ø)
...taview/src/views/table/datafileTable.component.tsx 100.00% <100.00%> (ø)
.../views/table/isis/isisDatafilesTable.component.tsx 100.00% <100.00%> (ø)
...c/views/table/isis/isisDatasetsTable.component.tsx 100.00% <100.00%> (ø)
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3cb1ca2...5b8fb7c. Read the comment docs.

Sam Glendenning added 2 commits April 22, 2022 16:26
@louise-davies
Copy link
Member

Other than those minor points about the tooltip it seems to be working well

@sam-glendenning sam-glendenning merged commit 2c86cee into develop May 4, 2022
@sam-glendenning sam-glendenning deleted the bugfix/no-downloading-of-empty-files-#1195 branch May 4, 2022 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working datagateway-dataview Issues corresponding to the dataview component. This component supersedes datagateway-table
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Individually downloading empty (0 bytes) files redirects to broken IDS download page
2 participants