refactor: move file download logic
parent
4f8156874d
commit
3f3e83c13a
|
@ -851,15 +851,11 @@ export default {
|
||||||
await this.deleteFromViewWithAnimation(delIds, updatedDays);
|
await this.deleteFromViewWithAnimation(delIds, updatedDays);
|
||||||
},
|
},
|
||||||
|
|
||||||
/** Download the selected files */
|
/**
|
||||||
async downloadSelection() {
|
* Download the currently selected files
|
||||||
if (this.selection.size === 0) {
|
*/
|
||||||
return;
|
downloadSelection() {
|
||||||
}
|
dav.downloadFilesByIds([...this.selection].map(p => p.fileid));
|
||||||
|
|
||||||
// Get files to download
|
|
||||||
const fileInfos = await dav.getFiles([...this.selection].map(p => p.fileid));
|
|
||||||
await dav.downloadFiles(fileInfos.map(f => f.filename));
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -171,3 +171,17 @@ export async function deleteFile(path) {
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Download the files given by the fileIds
|
||||||
|
* @param {number[]} fileIds
|
||||||
|
*/
|
||||||
|
export async function downloadFilesByIds(fileIds) {
|
||||||
|
if (fileIds.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get files to download
|
||||||
|
const fileInfos = await getFiles(fileIds);
|
||||||
|
await downloadFiles(fileInfos.map(f => f.filename));
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue