jupyterlab-filesystem-access icon indicating copy to clipboard operation
jupyterlab-filesystem-access copied to clipboard

Update to JupyterLab 3.4 and fix toolbar

Open martinRenou opened this issue 2 years ago • 10 comments

Fix #31

martinRenou avatar May 10 '22 12:05 martinRenou

This is currently not working properly, the issue with this code it that it "steals" the toolbar buttons from the main filebrowser. The toolbar buttons don't show up anymore on the main filebrowser, they show up only on our custom one.

toolbar

martinRenou avatar May 10 '22 12:05 martinRenou

Also the "New Launcher" button should not be there as it doesn't work properly with our filesystem API (not yet?)

martinRenou avatar May 10 '22 12:05 martinRenou

the issue with this code it that it "steals" the toolbar buttons from the main filebrowser

Maybe this discussion on the original PR might help (haven't double checked the details yet): https://github.com/jupyterlab/jupyterlab/pull/12281#discussion_r836607047

jtpio avatar May 10 '22 12:05 jtpio

@jtpio I'm reusing the changes proposed in this discussion indeed. Though it does not seem to behave the way we want.

martinRenou avatar May 10 '22 13:05 martinRenou

I pushed another commit that seems to work. I couldn't make it work with a custom config without breaking the main Filebrowser.

martinRenou avatar May 10 '22 15:05 martinRenou

The toolbar generator from settings schema is registering a transformation of the settings to build them by gathering definition from multiple extensions. When using the same helper on the same settings, it fails as it is forbidden to register multiple transform operators on the same plugin.

This definitely needs to be fixed. But as mentioned above, as some buttons are not valid for this file browser, it will be better to use this extension settings.

Problematic call:

https://github.com/jupyterlab/jupyterlab/blob/a41b9816fdedb936be1589dbc98363f62f5f4574/packages/apputils/src/toolbar/factory.ts#L109

fcollonval avatar May 10 '22 16:05 fcollonval

@martinRenou I pushed a patch to use the settings to customize the toolbar. It is independent of the standard filebrowser toolbar definition, hence the additional code (+ the need to wait for an upstream fix in jupyterlab/jupyterlab#12556)

fcollonval avatar May 11 '22 08:05 fcollonval

Thanks!

martinRenou avatar May 11 '22 08:05 martinRenou

@martinRenou wondering if this is now unblocked now that JupyterLab 3.4.3 is out with the fix in https://github.com/jupyterlab/jupyterlab/pull/12556?

jtpio avatar Jun 15 '22 16:06 jtpio

I'll give this another try tomorrow :)

martinRenou avatar Jun 15 '22 16:06 martinRenou

Is this still an open issue? I've lost track of what's working where across JL3/4 "standard" and lite (and where I had things that were woking but unpinned they're starting to break in ways that are hard to track as I try to update them for the new academic year!)

psychemedia avatar Oct 04 '23 11:10 psychemedia

Yes this is still needed.

This extension does not work with JupyterLab 4.

martinRenou avatar Oct 04 '23 11:10 martinRenou

Aside from JL4, is this fixed in JL3 too? Or is the extension deprecated now for JLv3 latest?

psychemedia avatar Oct 04 '23 12:10 psychemedia

Sorry I did not mean to close this. It is not fixed for JupyterLab 4 or 3.

martinRenou avatar Oct 04 '23 12:10 martinRenou

There is an issue to update to JupyterLab 4: https://github.com/jupyterlab-contrib/jupyterlab-filesystem-access/issues/54

jtpio avatar Oct 04 '23 12:10 jtpio

@fcollonval I'm trying to pick this up as part of https://github.com/jupyterlab-contrib/jupyterlab-filesystem-access/pull/55.

What would be the recommended way to define toolbar items via the setting system for this custom drive, so it doesn't conflict with the default filebrowser? This custom drive uses createFileBrowser to instantiate a new file browser, should the configuration still reference FileBrowser like the following?

"jupyter.lab.toolbars": {
  "FileBrowser": [
    { "name": "open-folder", "rank": 0 }
  ]
}

jtpio avatar Oct 20 '23 13:10 jtpio

Answering my own question: this is possible using a combination of setToolbar and createToolbarFactory.

image

I'll check if there are mentions to that in the JupyterLab docs and post them here. Or open an issue in JupyterLab otherwise.

jtpio avatar Oct 20 '23 13:10 jtpio

I'll check if there are mentions to that in the JupyterLab docs and post them here

This is the relevant bit: https://jupyterlab.readthedocs.io/en/latest/extension/extension_points.html#generic-widget-with-toolbar

jtpio avatar Oct 20 '23 13:10 jtpio