Skip to content
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

Merged
merged 3 commits into from Aug 22, 2019
Merged

accept query parameter to optionally change file browser location #6875

merged 3 commits into from Aug 22, 2019

Conversation

dmarth
Copy link

@dmarth dmarth commented Jul 23, 2019

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 notebook test/example.ipynb while still showing the workspace root directory in the filebrowser (instead of the test directory).

@jupyterlab-dev-mode
Copy link

Thanks for making a pull request to JupyterLab!

To try out this branch on binder, follow this link: Binder

@mlucool
Copy link
Contributor

mlucool commented Aug 20, 2019

@afshin - when do you expect to be able to review this? This solves a problem we have as well.

Copy link
Member

@blink1073 blink1073 left a 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) {
Copy link
Member

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

@dmarth
Copy link
Author

dmarth commented Aug 22, 2019

@blink1073 thanks for your feedback, I changed the parameter format.

@blink1073
Copy link
Member

blink1073 commented Aug 22, 2019

Thanks for adding this, @dmarth! We have docs in the tree url here, do you mind adding text along the lines of the PR description?

Copy link
Member

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@blink1073
Copy link
Member

Thanks @dmarth and congratulations on your first PR to JupyterLab! 🚀

@blink1073 blink1073 merged commit cd2fb6a into jupyterlab:master Aug 22, 2019
@dmarth dmarth deleted the feature-filebrowser-location-parameter branch August 22, 2019 13:14
@blink1073 blink1073 added this to the 1.1 milestone Aug 22, 2019
@lock lock bot added the status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label Sep 21, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Sep 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants