-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a "Hub Control Panel" menu item if running inside a JupyterHub #79
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I want to provide a button to the Hub Control Panel when we are running under a JupyterHub. This requires conditional rendering in some way - either we render the initial HTML as a template, or setup an API endpoint that JS can use. This PR templatizes the initial rendering. The following changes are made: 1. Convert into a Jupyter Server extension. This gives us the flexibility we need here. 2. Inherit a handler directly from jupyter_server_proxy, enabling us to use the *same* URL for both the initial HTTP rendering and the websockify! However, this means we lose the launcher icon - let's try mitigate that somehow.
This is simpler than inheriting from the proxying handler from jupyter_server_proxy directly, and more importantly keeps our launcher entry simple and existing!
This was referenced Feb 4, 2024
yuvipanda
commented
Feb 5, 2024
manics
approved these changes
Feb 5, 2024
Thanks @yuvipanda ! Long journey but totally worth it. |
Thank you for your patience, @unode! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Based on #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:
from a purely static JS code to figure out if we were on the hub, and if so,
where the hub control panel is
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.
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 #57