mckinsey / vizro

Vizro is a toolkit for creating modular data visualization applications.
https://vizro.readthedocs.io/en/stable/
Apache License 2.0
2.73k stars 142 forks source link

File browser widget #591

Open LiShaoyu5 opened 4 months ago

LiShaoyu5 commented 4 months ago

Which package?

vizro

What's the problem this feature will solve?

The widget contains an interactive file browser and returns its state(current path, etc.) and events like clicking a file in it. Other libraries I tried(like Gradio and Streamlit) only provide the feature of uploading and downloading files. But for data visualization, a lot of times I need to deal with directories.

Describe the solution you'd like

The third-party addon streamlit-file-browser of Streamlit shows a nice way of implementing it: image The widget connects to a local directory or a file server and returns a dict showing its current state, including the path and whether the user clicks a folder or a file.

Code of Conduct

antonymilne commented 4 months ago

Hello @LiShaoyu5 and thank you for raising the issue. It's an interesting idea and not one we've heard before. #473 and #281 are about uploading files but don't contain the file browser like you describe here.

For there to be any chance of us implementing this in Vizro it would first of all need to exist in Dash. Do you know of any such functionality @AnnMarieW?

huong-li-nguyen commented 4 months ago

Hey @LiShaoyu5,

I came across a Dash user-created component that might be what you're looking for: File Explorer Tree Generator for Local Files. Seems like @AnnMarieW has contributed to this one! 😄

As @antonymilne mentioned, if it works in Dash, we can definitely get it working in Vizro too. Just a quick note, the solution in the forum is user-generated, so it might not be fully tested. If you need something quick, you could give the code snippet they provided a try. If you’ve tried it out and want to embed it into Vizro, you can follow our guide on creating custom components. If you have any questions there, let us know!

This component isn’t on our roadmap right now. For us to consider adding a fully tested and styled version to our repository, we’d need to see more interest from other users. So I'll keep this issue open to see if others are interested too 👍

I hope this helps! 🤞

LiShaoyu5 commented 4 months ago

Hello @huong-li-nguyen thanks for your detailed reply! I think this will work for me and I will try it out.

lingyielia commented 4 months ago

@antonymilne @huong-li-nguyen fyi, I came across this repo yesterday, which looks quite advanced and up-to-date: https://github.com/fohrloop/dash-uploader