jupyterlab-contrib / jupyterlab-topbar

JupyterLab Top Bar extensions
BSD 3-Clause "New" or "Revised" License
108 stars 17 forks source link

Button to UI for managing named servers #32

Open jhgoebbert opened 5 years ago

jhgoebbert commented 5 years ago

Hello jtpio,

another real helpful button could be one in JupyterHub scenario, which sends the user back to the control panel, which lists all running jupyter notebook servers in jupyterhub 1.x: https://miro.medium.com/max/1482/1*VozbyUHN9qTICXzQSKQvfw.png

I tried to use jupyterlab-logout for that and make it point to https:///integration/hub/start with function () { router.navigate('/hub/start', { hard: true }) which is obviously wrong as it points to https:///integration/user///hub/start

Do you have any idea how that could be possible? Perhaps that could be another button for jupyterlab-topbar.

Best regards, Jens Henrik

jtpio commented 5 years ago

@jhgoebbert if by pointing it to /hub/home?

jtpio commented 5 years ago

Or rather: router.navigate('/home')

jhgoebbert commented 5 years ago

If that leads to the page for named server, which was introduced with JupyterHub 1.0 ( https://blog.jupyter.org/announcing-jupyterhub-1-0-8fff78acad7f ), it would be perfekt. I will test it.

jtpio commented 5 years ago

They should indeed show up on the home page.

If that works maybe it's worth making a new jupyterlab-hub extension, that could expose some of these shortcuts to the user when used in a JupyterHub environment.

The existing hub-extension in JupyterLab core already has some integration with JupyterHub, limited to Control Panel and Log Out for now:

image

jhgoebbert commented 5 years ago

Great. The hub-integration extension is hiding the "Log Out" and "Hub Control Panel" in the File menu. Users often do not find it there and are not aware of this functionality. Having a button would fix that.

kreuzert commented 5 years ago

Hey jtpio, I hope you don't mind that I created a package for this ( https://www.npmjs.com/package/jupyterlab-control ) and linked you there. The only problem right now is that JupyterLab has no /home path. One has to add a redirect rule to the proxy, to catch the /home path of the JupyterLab.

An example for our nginx (where users name are emails, and JupyterLab Names are restricted to [a-z0-9]): location ~ "/user/([a-z0-9.-]+)@([\da-z.-]+).([a-z.]{2,6})/[a-z0-9_]+/home" { return 301 /hub/home; }

If you want to add such a package by yourself I can remove my package.

jtpio commented 5 years ago

That's great, thanks @kreuzert for sharing!

I hope you don't mind that I created a package for this ( https://www.npmjs.com/package/jupyterlab-control ) and linked you there.

No problem at all! Credit is not required but thanks for the shout-out :)

The only problem right now is that JupyterLab has no /home path. One has to add a redirect rule to the proxy, to catch the /home path of the JupyterLab.

Maybe there could be some logic that checks whether JupyterLab is running in a hub environment, like this: https://github.com/jupyterlab/jupyterlab/blob/master/packages/hub-extension/src/index.ts#L49-L52

If you want to add such a package by yourself I can remove my package.

I had no plans to create such package. If you want we can add a link to it in the list of topbar extensions: https://github.com/jtpio/jupyterlab-topbar#extensions