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
Adding file size to File browser hover #7485
Conversation
Thanks for making a pull request to JupyterLab! To try out this branch on binder, follow this link: |
packages/filebrowser/src/listing.ts
Outdated
@@ -1833,8 +1833,13 @@ export namespace DirListing { | |||
// clean up the svg icon annotation, if any | |||
delete icon.dataset.icon; | |||
} | |||
// add file size to pop up if its available | |||
if (model.size !== null && model.size !== undefined) { | |||
node.title = model.name + ' - ' + Private.formatFileSize(model.size, 1); |
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 for adding this! I think it looks too sparse without adding more info. I think we should show the following:
Name: foo.bar
Size: as you have it
Path: path limited to 50 chars with an ellipsis if longer
Created: Formatted using Time.format.
Modified: Same as above
Similar to what Finder shows on MacOS about a file:
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.
And just not show the size part if we don't have 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.
Yeah that looks better. Let me fix it.
only show directory in Path Fixes jupyterlab#7352
Perfect, thanks again @macwoj! |
References
Fixes #7352
Code changes
added size field to the Contents.IModel
added more file context to title in updateItemNode (filebrowser/src/listing.ts)
User-facing changes
Hover in file vrowser will now show.
Name:
Size: If available the human readable file size with a single decimal.
Path: only the directory limited to 50
Created: YYYY-MM-DD HH:mm:ss
Modified: YYYY-MM-DD HH:mm:ss
Backwards-incompatible changes
added new field which is optional so no backwards compatibility issues.