feat(files): add batch support to copy-move#42124
Merged
Conversation
8 tasks
artonge
reviewed
Dec 11, 2023
emoral435
previously approved these changes
Dec 11, 2023
Contributor
emoral435
left a comment
There was a problem hiding this comment.
Tested this on my local dev setup and it works 👌 Only thing I would change is the redundant if statements with using the MOVE_OR_COPY in this file, but that's more of a nitpick than anything
emoral435
reviewed
Dec 11, 2023
Contributor
emoral435
left a comment
There was a problem hiding this comment.
Overall, this works on my dev setup, just needs the changes requested 👌
60129d2 to
fbc3e34
Compare
skjnldsv
commented
Dec 12, 2023
Comment on lines
+253
to
+270
| async execBatch(nodes: Node[], view: View, dir: string) { | ||
| const action = getActionForNodes(nodes) | ||
| const result = await openFilePickerForAction(action, dir, nodes) | ||
| const promises = nodes.map(async node => { | ||
| try { | ||
| await handleCopyMoveNodeTo(node, result.destination, result.action) | ||
| return true | ||
| } catch (error) { | ||
| logger.error(`Failed to ${result.action} node`, { node, error }) | ||
| return false | ||
| } | ||
| }) | ||
|
|
||
| // We need to keep the selection on error! | ||
| // So we do not return null, and for batch action | ||
| // we let the front handle the error. | ||
| return await Promise.all(promises) | ||
| }, |
Member
Author
There was a problem hiding this comment.
Muuuuuuuuuch cleaner!
Now we don't mix picking the folder AND executing the action :)
emoral435
approved these changes
Dec 12, 2023
Contributor
emoral435
left a comment
There was a problem hiding this comment.
LGTM! Really nice changes : D
susnux
approved these changes
Dec 12, 2023
|
|
||
| return new Promise((resolve, reject) => { | ||
| filePicker.setButtonFactory((nodes: Node[], path: string) => { | ||
| filePicker.setButtonFactory((_selection, path: string) => { |
artonge
approved these changes
Dec 12, 2023
Contributor
|
/compile / |
Member
Author
|
/backport to stable28 |
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
03268f6 to
5d74f1a
Compare
Member
Author
|
/backport to stable28 |
Member
Author
|
Backport in #42279 |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #41661
Later
There are room for improvements, especially on how we handle promises-chaining 🤔Also, we should either refresh the view, or, if the destination is within the current displayed dir, refresh its content.