Download files in the View

Description of the limitation and why it is relevant to address

As a developer I want to have the possibility to download files that have been generated during the process of generating a view without needing to have to save it to storage and create a download button on the left hand side so that the developer does not have to go through the troubles of creating this workaround, and the user has an intuitive location to download the results.

I think this is relevant for the VIKTOR platform because it makes developing easier, and makes applications more intuitive.

Submitter proposed design (optional)

Add a possibility to send a DownloadResult as an argument on a view, which will cause a download button to appear in the view where you can download your result.

Current workarounds

Create a DownloadButton in the parametrization, and use storage to save the results of the visualization.

Great idea!

Last week we released an app that had this use case. Fixed it for now by having 1 common function that creates a DataFrame. That function is called by both the view method (using the TableView) and the download method.

It looks like 2 issues are addressed in the proposal:

  1. Prevent having to re-calculate the same thing (or use Storage / memoize) for the 2 outputs (view and download)
  2. Prevent the need for adding an extra DownloadButton in the params and integrate it into the view UI.

I do wonder though, if 1 is actually solvable. Wouldn’t you nearly always want some additional layout code for both outputs. Probably formatting related.

Solving 2 would be nice, since it would improve the UI/UX as well: A user would download the result on the same place where the results are shown.