feat(files): add bulk download for files and guard folder downloads (#18)
CD — Deployment / deploy (push) Successful in 15s
CD — Deployment / deploy (push) Successful in 15s
PR automatique de feat/bulk-download-folders vers main. --------- Co-authored-by: xEsiah <[email protected]> Reviewed-on: #18 Reviewed-by: Esiah <[email protected]> Co-authored-by: Gitea Actions <-[email protected]>
This commit was merged in pull request #18.
This commit is contained in:
@@ -204,6 +204,8 @@ const en: Record<string, string> = {
|
|||||||
"{count} éléments seront déplacés.": "{count} items will be moved.",
|
"{count} éléments seront déplacés.": "{count} items will be moved.",
|
||||||
"{count} élément(s) seront placés dans la corbeille.":
|
"{count} élément(s) seront placés dans la corbeille.":
|
||||||
"{count} item(s) will be moved to the trash.",
|
"{count} item(s) will be moved to the trash.",
|
||||||
|
"Seuls les fichiers peuvent être téléchargés.": "Only files can be downloaded.",
|
||||||
|
"Les dossiers n'ont pas été téléchargés.": "Folders were not downloaded.",
|
||||||
|
|
||||||
// --- Visionneuse -------------------------------------------------------
|
// --- Visionneuse -------------------------------------------------------
|
||||||
"Lecture impossible.": "Unable to read.",
|
"Lecture impossible.": "Unable to read.",
|
||||||
|
|||||||
@@ -636,13 +636,19 @@ export const Browser = () => {
|
|||||||
size="sm"
|
size="sm"
|
||||||
variant="secondary"
|
variant="secondary"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
for (const target of selectedItems) {
|
const files = selectedItems.filter((t) => t.type === "file");
|
||||||
if (target.type === "file") {
|
if (files.length === 0) {
|
||||||
const link = document.createElement("a");
|
toast.info(t("Seuls les fichiers peuvent être téléchargés."));
|
||||||
link.href = api.downloadUrl(target.id);
|
return;
|
||||||
link.download = target.name;
|
}
|
||||||
link.click();
|
for (const target of files) {
|
||||||
}
|
const link = document.createElement("a");
|
||||||
|
link.href = api.downloadUrl(target.id);
|
||||||
|
link.download = target.name;
|
||||||
|
link.click();
|
||||||
|
}
|
||||||
|
if (files.length < selectedItems.length) {
|
||||||
|
toast.info(t("Les dossiers n'ont pas été téléchargés."));
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user