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
accept query parameter to optionally change file browser location #6875
accept query parameter to optionally change file browser location #6875
Conversation
Thanks for making a pull request to JupyterLab! To try out this branch on binder, follow this link: |
@afshin - when do you expect to be able to review this? This solves a problem we have as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small comment. The CI failure is unrelated, I'm addressing it in #7055
@@ -275,6 +275,11 @@ const tree: JupyterFrontEndPlugin<void> = { | |||
// Remove the tree portion of the URL leaving the rest intact. | |||
router.navigate(url); | |||
|
|||
const query = URLExt.queryStringToObject(args.search); | |||
if (query.filebrowserPath) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to stick with URI tradition and use file-browser-path
for the parameter name. cf https://stackoverflow.com/a/18450653
@blink1073 thanks for your feedback, I changed the parameter format. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Thanks @dmarth and congratulations on your first PR to JupyterLab! 🚀 |
References
#6874
Code changes
It is now possible to pass a query parameter called
filebrowserPath
to the tree route handler. If this parameter is set, the filebrowser is navigated to this path.User-facing changes
By default, the behavior does not change for the user. Only if the
filebrowserPath
parameter is passed, the location of the filebrowser differs from the location of the opened notebook.For example, the URL
/lab/tree/test/example.ipynb?filebrowserPath=/
shows the notebooktest/example.ipynb
while still showing the workspace root directory in the filebrowser (instead of thetest
directory).