jupyterhub / jupyter-remote-desktop-proxy

Run a Linux Desktop on a JupyterHub
BSD 3-Clause "New" or "Revised" License
105 stars 101 forks source link

Add a "Hub Control Panel" menu item if running inside a JupyterHub #79

Closed yuvipanda closed 5 months ago

yuvipanda commented 5 months ago

Based on https://github.com/jupyterhub/jupyter-remote-desktop-proxy/pull/78

I wanted to provide a "Hub Control Panel" menu item only when running in a JupyterHub. To do this, we need to figure out when we are running in a JupyterHub. There were two ways to do this:

  1. Expose an API endpoint as a Jupyter Server extension, and then talk to this from a purely static JS code to figure out if we were on the hub, and if so, where the hub control panel is
  2. Render the html as a jinja2 template from a Jupyter Server extension, leaving websockify for jupyter-server-proxy to handle

After some poking around (and trying a 3rd approach that's more complex), (2) seems the right path.

image

A "Hub Control Panel" button is now added if we are running inside a hub, but not added if we are not running inside a hub. I've tried to stick to how other projects does it to whatever extent I can.

I'm also very excited because this gives us other extension opportunities in the future :)

Fixes https://github.com/jupyterhub/jupyter-remote-desktop-proxy/issues/57

github-actions[bot] commented 5 months ago

Binder :point_left: Launch a binder notebook on this branch for commit d1534602df275e45960c3b65a86e626c9ef34146

I will automatically update this comment whenever this PR is modified

Binder :point_left: Launch a binder notebook on this branch for commit 831fe1f13f45b708b9a4f0c611412a5c9fca56d7

Binder :point_left: Launch a binder notebook on this branch for commit 0fadd168477465519821bdec5425d35802171766

unode commented 5 months ago

Thanks @yuvipanda ! Long journey but totally worth it.

yuvipanda commented 5 months ago

Thank you for your patience, @unode!