Uh oh!
There was an error while loading. Please reload this page.
feat(files): add batch support to copy-move - #42124
Conversation
Uh oh!
There was an error while loading. Please reload this page.
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
left a comment
There was a problem hiding this comment.
Overall, this works on my dev setup, just needs the changes requested 👌
Uh oh!
There was an error while loading. Please reload this page.
60129d2 to
fbc3e34Compare| 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) | ||
| }, |
There was a problem hiding this comment.
Muuuuuuuuuch cleaner!
Now we don't mix picking the folder AND executing the action :)
emoral435
left a comment
There was a problem hiding this comment.
LGTM! Really nice changes : D
| return new Promise((resolve, reject) => { | ||
| filePicker.setButtonFactory((nodes: Node[], path: string) => { | ||
| filePicker.setButtonFactory((_selection, path: string) => { |
emoral435
commented
Dec 13, 2023
/compile / |
skjnldsv
commented
Dec 13, 2023
/backport to stable28 |
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
03268f6 to
5d74f1aCompareskjnldsv
commented
Dec 14, 2023
/backport to stable28 |
skjnldsv
commented
Dec 14, 2023
Backport in #42279 |
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.