-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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 functionality to upload folder by dragging to file browser #10596
Conversation
Thanks for submitting your first pull request! You are awesome! 🤗 |
Thanks for making a pull request to JupyterLab! To try out this branch on binder, follow this link: |
We had some short discussion with @blink1073 on the use of experimental API in this PR. I think that we are fine because over 90% of users and all browsers that we support already support this experimental API. However as recommended by MDN docs we should be very careful and defensive when using it; I would suggest checking support first and if it is not there then falling back to the error dialog. Please let me know if you need help with creating new folders using JupyterLab filebrowser API. |
Yes, I also feel that retrieving the folder structure is necessary. |
Yeah sure, I will check their support and will implement accordingly. I'll try to implement folder creation. In case, I'll need your help I'll surely let you know. Thanks for asking. 😃 |
I got my head around with the createNewDirectory() function from browser.ts. But I am unable to figure out that how to access the Will you please help me with the same? Also, after creating the folder. I am planning to call Will you please tell me if I am following the correct workflow or not? 😅 |
Yes you are going in the right direction. A very quick note that you probably do not want to use |
Hey @krassowski, I have implemented the I have pushed the code. Will you please help me with the same? |
@krassowski I made the |
Ok, this is working now. Still may need some work to work faster. Ideally would have a test case. Still, I think it is an improvement worth considering for 4.3.0. |
We can probably avoid changing the directory by adding a path argument to |
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.
This looks good to me, but I would appreciate another review
packages/filebrowser/src/listing.ts
Outdated
/** | ||
* Signal emitted on when all files were uploaded after native drag. | ||
*/ | ||
protected get uploadedAll(): ISignal<DirListing, void> { |
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.
Maybe something like allUploaded
reads better, and would be similar to the naming of other signals?
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, done!
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.
This looks great! I tested the change locally, and I noticed that it worked successfully. A progress meter would be useful when uploading a large directory or a directory with many large files in it, but that's already covered by #4687, so we shouldn't hold this PR up for that reason.
Hmm... this made me think that we could already use the progress bar if we moved the logic to the listing model. Actually, I think we should move the logic to |
While I think that progress bar for the entire folder would be useful, I do not have bandwidth before 4.3 freeze. If we decide to move the logic to the
|
References
Add folder upload functionality, fixes #9838
Code changes
in packages/filebrowser/src/listing.ts
I have commented the previous code, which was displaying the dialog box if anyone tries to upload folders, and added the code to upload the folder.
User-facing changes
I haven't added any UI components. I have just removed the error dialog popping up while trying to upload the folder as shown below.
Instead of that, now it will upload the files from the folder.
Backwards-incompatible changes
I haven't implemented any backward-incompatible changes.