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

"Export Plots" functionality only downloads the first 10 plots. #1873

Closed
robsyme opened this issue Mar 3, 2023 · 3 comments · Fixed by #2059
Closed

"Export Plots" functionality only downloads the first 10 plots. #1873

robsyme opened this issue Mar 3, 2023 · 3 comments · Fixed by #2059
Labels
awaits-review Awaiting final review and merge. bug: core Bug in the main MultiQC code core: front end

Comments

@robsyme
Copy link
Contributor

robsyme commented Mar 3, 2023

When using the "Export" tab in the right-hand sidebar and more than ten plots are selected for export, only the first 10 plots are downloaded.

I have tried this on both Chrome and Safari, so I don't think that this is a browser limitation.

Example report: 5_multiqc_report.html.zip

@ewels
Copy link
Member

ewels commented Mar 3, 2023

How has no-one ever reported this before? 🤯

@ewels ewels added bug: core Bug in the main MultiQC code core: front end labels Mar 3, 2023
@vladsavelyev
Copy link
Member

vladsavelyev commented Aug 10, 2023

After playing with this a bit, it looks like it's a browser limitation after all. It seems to behave differently across browsers though.

Here is a toy HTML page with one button that generates and downloads 20 files. In Chrome, for me, it would download only the first 10 files (sample_1.txt through sample_10.txt). Safari though downloads only one last file (sample_20.txt).

<!DOCTYPE html>
<html>
<head>
  <title>Test downloads</title>
</head>
<body>
  <button id="downloadButton">Download Files</button>

  <script>
    document.getElementById("downloadButton").addEventListener("click", function() {
      for (let i = 1; i <= 20; i++) {
        const content = `sample_${i}`;
        const fileName = `sample_${i}.txt`;

        const blob = new Blob([content], { type: "text/plain" });
        const link = document.createElement("a");
        link.href = URL.createObjectURL(blob);
        link.download = fileName;
        link.click();
      }
    });
  </script>
</body>
</html>

Though after multiple attempts, Chrome suddenly learned to download all 20 at the same time, so it's not very reproducible.

One obvious solution would be to put all images into a zip archive and just download that archive instead. I tried to dig through the HighCharts codebase to find a more or less elegant solution for that with no success. I think since we will be looking for a HighCharts replacement, probably it's not worth it to hack it too much.

Another idea is to add a small timeout between each batch of 10 downloads. The problem is that it would require the user to confirm each batch in the browser, which is not super user-friendly, and also, quiet hacky.

So no solution for now, let's discuss options!

@ewels
Copy link
Member

ewels commented Aug 18, 2023

I think zipping if there are > 8 plots or something could be good. Pretty sure I've written in-browser JS creation of zip files in the distant past at some point, feel like it should be possible..? 🤔

I'm not sure that a new plotting library will solve this issue, as we will still want the ability for people to export multiple plots in one go.

@ewels ewels added this to the MultiQC v1.16 milestone Sep 13, 2023
@ewels ewels added the awaits-review Awaiting final review and merge. label Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaits-review Awaiting final review and merge. bug: core Bug in the main MultiQC code core: front end
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants