selection: move to custom dialog

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/783/head
Varun Patil 2023-08-21 17:40:03 -07:00
parent 60281c1f7f
commit 7eb9ffc3bf
1 changed files with 30 additions and 12 deletions

View File

@ -768,11 +768,17 @@ export default defineComponent({
* Download the currently selected files * Download the currently selected files
*/ */
async downloadSelection(selection: Selection) { async downloadSelection(selection: Selection) {
if (selection.size >= 100) { if (
if (!confirm(this.t('memories', 'You are about to download a large number of files. Are you sure?'))) { selection.size >= 100 &&
!(await utils.confirmDestructive({
title: this.t('memories', 'Download'),
message: this.t('memories', 'You are about to download a large number of files.'),
confirm: this.t('memories', 'Continue'),
cancel: this.t('memories', 'Cancel'),
}))
) {
return; return;
} }
}
await dav.downloadFilesByPhotos(selection.photosNoDupFileId()); await dav.downloadFilesByPhotos(selection.photosNoDupFileId());
}, },
@ -798,11 +804,17 @@ export default defineComponent({
* Delete the currently selected photos * Delete the currently selected photos
*/ */
async deleteSelection(selection: Selection) { async deleteSelection(selection: Selection) {
if (selection.size >= 100) { if (
if (!confirm(this.t('memories', 'You are about to delete a large number of files. Are you sure?'))) { selection.size >= 100 &&
!(await utils.confirmDestructive({
title: this.t('memories', 'Delete'),
message: this.t('memories', 'You are about to delete a large number of files'),
confirm: this.t('memories', 'Continue'),
cancel: this.t('memories', 'Cancel'),
}))
) {
return; return;
} }
}
try { try {
for await (const delIds of dav.deletePhotos(selection.photosNoDupFileId())) { for await (const delIds of dav.deletePhotos(selection.photosNoDupFileId())) {
@ -834,11 +846,17 @@ export default defineComponent({
* Archive the currently selected photos * Archive the currently selected photos
*/ */
async archiveSelection(selection: Selection) { async archiveSelection(selection: Selection) {
if (selection.size >= 100) { if (
if (!confirm(this.t('memories', 'You are about to move a large number of files. Are you sure?'))) { selection.size >= 100 &&
!(await utils.confirmDestructive({
title: this.t('memories', 'Move'),
message: this.t('memories', 'You are about to move a large number of files'),
confirm: this.t('memories', 'Continue'),
cancel: this.t('memories', 'Cancel'),
}))
) {
return; return;
} }
}
for await (let delIds of dav.archiveFilesByIds(Array.from(selection.fileids()), !this.routeIsArchive)) { for await (let delIds of dav.archiveFilesByIds(Array.from(selection.fileids()), !this.routeIsArchive)) {
this.deleteSelectedPhotosById(delIds, selection); this.deleteSelectedPhotosById(delIds, selection);