-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
FileBrowser: Added the sortNotebooksFirst option
#14497
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
Conversation
closes jupyterlab#14332 - When disabled, the file browser sorts the directories above all other files (doesn't modify the current behavior) - When enabled, the file browsers sorts the directories abover everything, then all notebooks above other files (matches the Notebook V6 behavior)
|
Thanks for making a pull request to jupyterlab! |
|
Thanks for submitting your first pull request! You are awesome! 🤗 |
for more information, see https://pre-commit.ci
|
Thanks @tpatel for working on this! |
krassowski
left a comment
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.
Looking good!
Co-authored-by: Michał Krassowski <5832902+krassowski@users.noreply.github.com>
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.
Thanks @tpatel
I have some questions. But generally this looks good, thanks!
| } | ||
|
|
||
| set sortNotebooksFirst(value: boolean) { | ||
| if (this.listing.setNotebooksFirstSorting) { |
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.
What is the reason for testing for setNotebooksFirstSorting?
As the listing is of type DirListing (no interface used), it will always exist, isn't it?
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 couldn't find why the setColumnVisibility was being checked. I believe it should always exist but I was a bit confused and went on the safe side. Do you have more info about this?
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.
Given how downstream swaps listing, maybe it should become an interface? (this is not a discussion for this PR though). I just wanted to highlight that unfold extension goes pretty far with the modifications and depending on the version of DirListing it would load the guard may actually be useful (well at least if this lands in 4.x rather than 4.0). We also wanted to modify listing in jupyterlab-git but can probably make dedicated APIs for that use case.
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.
Probably this condition was indeed added to make it easier for downstream applications to customize the file browser.
Thanks for providing the extra context, agree we can track follow-ups in other issues 👍
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.
Ok then I'll agree we should keep the safe guard test. But I still would like to switch to a getter/setter pattern. @tpatel, you could replace the safeguard condition by
if (this.notebooksFirstSorted !== undefined)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.
switch to a getter/setter pattern
Would it be possible to address this in a separate PR? And address this for showLastModifiedColumn or showFileSizeColumn as well for consistency?
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 think it makes sense to address moving both methods to the getter/setter pattern in a separate PR to avoid being in a state with two different patterns 👍
Co-authored-by: Frédéric Collonval <fcollonval@users.noreply.github.com>
This reverts commit 1abef20. This shouldn't be commited until the discussion https://github.com/jupyterlab/jupyterlab/pull/14497/files/d47d50bbeb2db80df09489eb7c9588c29a140d22#r1189492709 is resolved.
|
It would be great to get this one in so it makes it to the final 4.0 release, and would directly benefit Notebook 7. Leaving it open until tomorrow in case @krassowski or @fcollonval have any more feedback. |
jtpio
left a comment
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.
Thanks!
As discussed during the JupyterLab weekly meeting today, it would be great to get this PR in so it can be used in Notebook 7.
This can be seen as a new feature to be included in a 4.1 release. But this can also be considered a "bug fix" for feature parity with the classic notebook.
Also having it opt-in like it is the case in this PR makes it easier to ship in a 4.0.x release.


References
Fixes #14332
Code changes
Changes to
filebrowser-extension:sortNotebooksFirstsettingChanges to
filebrowser:sortNotebooksFirstproperty storing the setting internally as_sortNotebooksFirstthat propagates changes to the listingsetNotebooksFirstSortingmethod storing the setting internally as_sortNotebooksFirst. Modifying it triggers a sorting operation.User-facing changes
New setting in the filebrowser header setting menu (which opens when right-clicking on the header).
The behavior is:
Backwards-incompatible changes
None