panel icon indicating copy to clipboard operation
panel copied to clipboard

Interest in a `FileInput` like widget that supports showing a selected server side file/directory full path

Open dalthviz opened this issue 7 months ago • 11 comments

Is your feature request related to a problem? Please describe.

Hi there, so, more than a problem, the main purpose of this issue is to ask if there could be any interest to add a new FileInput like widget that allows browsing server side files/directories and can show a selected file/directory full path.

Describe the solution you'd like

A custom widget has been implement for that but maybe it could be nice to make it part of the base Panel widgets

Describe alternatives you've considered

One alternative to enable reusage of the widget could be the creation of an extension instead of adding it directly to Panel

Additional context

An initial implementation of the described widget works something like this:

Image

Could it make sense to upstream this kind of widget or maybe is better to just make an extension for it? Are there other alternatives that could help make this custom widget more reusable or allow for better support of this use case (browse server side files/directories and show a selected file/directory full path in a FileInput widget manner)?

If there is any interest to include the custom widget as part of Panel let me know, I could make a PR adding it :)

dalthviz avatar Jun 06 '25 17:06 dalthviz

Hi @dalthviz . See this PR which is related. Would that cover your request?

https://github.com/holoviz/panel/pull/6837

Philip has commented in that PR.

Coderambling avatar Jun 08 '25 10:06 Coderambling

Were you able to have a look at the PR @dalthviz ? Can you clarify what custom widget you are referring to?

A custom widget has been implement for that but maybe it could be nice to make it part of the base Panel widgets

Coderambling avatar Jun 09 '25 14:06 Coderambling

Thank you for giving this a check @Coderambling ! I gave a quick check to the PR linked and although that improves the UI to choose files (with a tree like view) I think one element that it doesn't cover is to save up space by not showing always the tree view. I think the PR linked could cover the request here if it adds also an option to hide/show the tree view somehow and instead just show the selected files/directories paths 🤔

Can you clarify what custom widget you are referring to?

So the custom widget is the one shown in the preview GIF in the issue description. The code for it is available at https://github.com/dharhas/hydrosurvey/blob/main/src/hydrosurvey/widgets/file_picker.py I opened this issue since we started discussing with @kcpevey exploring the possibility/interest to add a widget like that to Panel itself

dalthviz avatar Jun 09 '25 16:06 dalthviz

With the below you mean only show currently selected items?

show the selected files/directories paths 🤔

Coderambling avatar Jun 09 '25 18:06 Coderambling

If the tree is wrapped in a Panel component, you can use the visible = Parameter to make it not visible.

You can use that with i.e. a Panel checkbox to turn it on/ off.

See the link below with an example, among other pages.

https://panel.holoviz.org/explanation/components/components_overview.html

Does that make sense?

Coderambling avatar Jun 09 '25 18:06 Coderambling

With the below you mean only show currently selected items?

show the selected files/directories paths 🤔

I mean instead of showing the view that helps select the files (like for example the tree view representation) show a string/text widget with the absolute paths of the selected files/directories. Kind of like the FileInput widget when you finish selecting files:

Image

If the tree is wrapped in a Panel component, you can use the visible = Parameter to make it not visible.

You can use that with i.e. a Panel checkbox to turn it on/ off.

See the link below with an example, among other pages.

https://panel.holoviz.org/explanation/components/components_overview.html

Does that make sense?

Yep, that does makes sense. In fact, the linked custom widget wraps currently the FileSelector widget in a modal to save space and not show always the widget that selects files/directories.

dalthviz avatar Jun 09 '25 19:06 dalthviz

Ok so the ability to switch between the current view and the widget? So like a tabbed view with File tree and the widget you mention above, or another way to switch between them?

Coderambling avatar Jun 11 '25 11:06 Coderambling

Ok so the ability to switch between the current view and the widget? So like a tabbed view with File tree and the widget you mention above, or another way to switch between them?

Yep, I would say so :+1: Not completly sure though what would be the more usable way to achieve that switching between the view that enables you to browser the files/directories and the view that enables you to just see the paths of the selected files/directories. It could be indeed a sort of tab or as the linked custom widget does a button + a modal or even as you mentioned another component like a checkbox or button that handles the visibility of the component that is being used to browse the files/directories while the component the shows the selected paths is always visible.

I think the modal option was used in the linked custom widget since that kind of mimicks the behavior (behavior in terms of flow of actions for the user i.e click a button, show a component/dialog that allows you to select files/directories, be able to close/finish the selection and show the selection result in another component) of the FileInput widget:

Widget Preview
FileInput Image
Linked custom widget Image

dalthviz avatar Jun 11 '25 17:06 dalthviz

Nice table! In case you weren't aware: a Tabs layout is available as one the layouts in Panel:

https://panel.holoviz.org/reference/layouts/Tabs.html

A radiobutton is also a standard component that could be used to switch between 2 views

Coderambling avatar Jun 13 '25 10:06 Coderambling

Thank you for the info @Coderambling :+1: I think you get more or less the idea of the widget now so, regardles of the details of how the switch of the view is done, do you think it makes sense to include such a widget as part of the base Panel widgets or maybe it makes more sense to you to just create a Panel extension that wraps a custom widget so reusage is easier? Or maybe you now about any other alternative that can make reusage of a custom widget implementation easier?

Anyhow thank you again for keeping up with this issue and sharing info/resources and ideas :)

dalthviz avatar Jun 13 '25 17:06 dalthviz

Sure! In fact, I was just wondering the same thing: would it make more sense as an extension :-)

Let me get back to you on that.

Coderambling avatar Jun 13 '25 17:06 Coderambling

This should probably be converted into a GitHub Discussion.

'Panel Extension vs Panel PR' is a question for the Panel lead maintainer / Project director: @philippjfr

I personally don't think it's so helpful to have a whole collection of file input widget extensions that are all quite similar, except for some particularities. It's probably better to integrate the best ideas into a single component in core Panel. I'd suggest commenting on the existing WIP file input PR https://github.com/holoviz/panel/pull/6837 with your suggestions, or even offer to help implement them if it's within your capacity.

That said you can always start an extension (https://github.com/panel-extensions) so that you (@dalthviz ) can continue to direct the development of it and continue to test out your ideas, especially if they are clearly distinct from the direction of the existing file input component. There's always a chance that it could fit into core Panel later on if the result is sufficiently compelling.

Hope this helps

droumis avatar Jun 23 '25 12:06 droumis