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

Allow download mulitple backing images with one click and move clean up action in detail modal #729

Merged
merged 2 commits into from
May 21, 2024

Conversation

a110605
Copy link
Contributor

@a110605 a110605 commented May 20, 2024

Goal

  • Allow user to sort the backing image list
  • Add bulk download button to allow user download mutliple backing images at once
  • Remove disk cleanup action in operation dropdown and move into detail modal

Issue

longhorn/longhorn#7293

Result

Sort the backing image list
sort

Bulk download : only has ready disk status image can be downloaded
d

Move cleanup action in detail modal
clean

@a110605 a110605 requested review from ChanYiLin, torchiaf and a team May 20, 2024 02:11
@a110605 a110605 self-assigned this May 20, 2024
// eslint-disable-next-line no-underscore-dangle
const downloadUrl = `${window.__pathname_prefix__}${window.__pathname_prefix__.endsWith('/') ? '' : '/'}v1/backingimages/${image.name}/download`
// specific way to download multiple files with one click, User may allow the browser to download multiple files at once
Object.assign(document.createElement('a'), { href: downloadUrl, download: image.name }).click()
Copy link
Contributor Author

@a110605 a110605 May 20, 2024

Choose a reason for hiding this comment

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

Current backing image download API only supports download one image at a time

v1/backingimages/${params.name}/download

This workaround is to create multiple download links and click them, but need user to give browser permission to do that. So I add a note in modal to let user know
Screenshot 2024-05-18 at 4 14 46 PM
Screenshot 2024-05-20 at 10 20 41 AM

The better approach is to zip the selected image from backend and has a new API to download that zip file. This is also how dropbox and google drive support download multiple files. cc @ChanYiLin

Refer : https://stackoverflow.com/questions/52072098/how-to-download-multiple-files-with-window-open#comment91093930_52072098:~:text=Better-,to,-return%20a%20ZIP

Copy link

@torchiaf torchiaf left a comment

Choose a reason for hiding this comment

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

LGTM

@a110605 a110605 requested a review from a team May 21, 2024 07:58
@a110605 a110605 merged commit bab25eb into longhorn:master May 21, 2024
5 checks passed
@ChanYiLin
Copy link

LGTM, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants