Skip to content

feat(files): add batch support to copy-move - #42124

Merged
skjnldsv merged 2 commits into
masterfrom
feat/files/batch-copy-move
Dec 14, 2023
Merged

feat(files): add batch support to copy-move#42124
skjnldsv merged 2 commits into
masterfrom
feat/files/batch-copy-move

Conversation

@skjnldsv

@skjnldsvskjnldsv commented Dec 8, 2023

Copy link
Copy Markdown
Member

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.

@skjnldsvskjnldsv added this to the Nextcloud 28.0.1 milestone Dec 8, 2023
@skjnldsv
skjnldsv requested review from a team, artonge and susnuxDecember 8, 2023 15:48
@skjnldsvskjnldsv self-assigned this Dec 8, 2023
@skjnldsv
skjnldsv requested review from emoral435 and removed request for a teamDecember 8, 2023 15:48
Comment threadapps/files/src/actions/moveOrCopyAction.ts Outdated
emoral435
emoral435 previously approved these changes Dec 11, 2023

@emoral435emoral435 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
emoral435 dismissed their stale reviewDecember 11, 2023 16:43

minor changes needed

@emoral435emoral435 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, this works on my dev setup, just needs the changes requested 👌

Comment threadapps/files/src/actions/moveOrCopyAction.ts Outdated
@skjnldsv
skjnldsvforce-pushed the feat/files/batch-copy-move branch from 60129d2 to fbc3e34CompareDecember 12, 2023 14:26
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)
},

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Muuuuuuuuuch cleaner!
Now we don't mix picking the folder AND executing the action :)

@emoral435emoral435 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Really nice changes : D


return new Promise((resolve, reject) => {
filePicker.setButtonFactory((nodes: Node[], path: string) => {
filePicker.setButtonFactory((_selection, path: string) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why removing the typing?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because unused :)

@emoral435

Copy link
Copy Markdown
Contributor

/compile /

@skjnldsvskjnldsv added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Dec 13, 2023
@skjnldsv

Copy link
Copy Markdown
MemberAuthor

/backport to stable28

Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
@skjnldsv
skjnldsvforce-pushed the feat/files/batch-copy-move branch from 03268f6 to 5d74f1aCompareDecember 14, 2023 08:52
@skjnldsv
skjnldsv merged commit 842a3d7 into masterDec 14, 2023
@skjnldsv
skjnldsv deleted the feat/files/batch-copy-move branch December 14, 2023 09:13
@skjnldsv

Copy link
Copy Markdown
MemberAuthor

/backport to stable28

@skjnldsv

Copy link
Copy Markdown
MemberAuthor

Backport in #42279

@blizzzblizzz mentioned this pull request Mar 5, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4. to releaseReady to be released and/or waiting for tests to finishfeature: filesregression

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[Bug]: Multiselect menu missing "Move or copy"

4 participants

@skjnldsv@emoral435@susnux@artonge