JuliaPluto / PlutoUI.jl

https://featured.plutojl.org/basic/plutoui.jl
The Unlicense
302 stars 55 forks source link

FilePicker to pick file on remote machines #153

Open juliohm opened 2 years ago

juliohm commented 2 years ago

When we are running Pluto remotely on a cluster or server shared with students the FilePicker opens directories in the local machine. This means that we can't create a button to access files stored in the remote machine where Pluto is running. It would be great if there could be a component that allows selecting a file on the computer where Pluto is running

dralletje commented 2 years ago

Gotta stop you here, this isn't a bug. Having a server-side file browser would be a great feature, shouldn't be too hard to make.

juliohm commented 2 years ago

Well, the definition of a bug is subjective I guess :)

dralletje commented 2 years ago

Read the docs

juliohm commented 2 years ago

Can't understand how reading the docs changes the definition of a bug or not. When I am running a Pluto instance on a remote machine and ask to select a file, and this file shows directories on another machine, that feels like a bug to me.

dralletje commented 2 years ago

A file upload box. The chosen file will be read by the browser, and the bytes are sent back to Julia.

I understand, if you haven't read this line but just the word FilePicker, it might feel like a bug. That's why the docs explain what it is really about. If it is not clear enough it is a bug, but a bug in the documentation.

I think having a remote file picker is something useful we could add, but as an open source maintainer yourself you must understand how frustrating it is when someone is pedantic about the features of a library you co-wrote.

juliohm commented 2 years ago

Yes, definitely the docs aren't very helpful specially if you assume that most of us in Julia don't have the web development expertise to infer that "read by the browser" is a local operation by definition.

Sorry if the word "bug" in the title annoyed you, I am just reporting something that I thought wasn't in your radar. Should the issue be reopened? What is the plan?

dralletje commented 2 years ago

It wasnt the word bug in the title, that was an honest mistake. It was the "Well, the definition of a bug is subjective I guess :)" that triggered me 🙃

I'll improve the issue text a bit and re-open it.

fonsp commented 2 years ago

Woah this is going to be a lot of work to create and maintain... Maybe you can use @bind filename Select(readdir(my_dir)) instead?

juliohm commented 2 years ago

@fonsp can you share some resources on how to implement this feature? There is no JS library ready that we could plug in PlutoUI.jl to access files remotely?

fonsp commented 2 years ago

If you already know which folder the file is in, and there are no subfolders:

@bind filename Select(readdir(my_dir))

You could add the ability to select subfolders by making readdir recursive, adding the path separator in filenames inside subdirs.


I am writing the rest for completeness, but it does not seem worth the effort:

A real filepicker with navigation is another step of difficulty, there might be a JS lib for that, the main thing then is converting data structures.

But a real, all-purpose remote file picker needs lazy-loading, which is not yet possible.