diff --git a/src/routes/(console)/project-[project]/storage/bucket-[bucket]/+page.svelte b/src/routes/(console)/project-[project]/storage/bucket-[bucket]/+page.svelte index e9a7fc50b3..abfacc6ebf 100644 --- a/src/routes/(console)/project-[project]/storage/bucket-[bucket]/+page.svelte +++ b/src/routes/(console)/project-[project]/storage/bucket-[bucket]/+page.svelte @@ -16,6 +16,7 @@ DropListLink, Empty, EmptySearch, + FloatingActionBar, PaginationWithLimit, SearchQuery } from '$lib/components'; @@ -30,7 +31,9 @@ TableCellText, TableHeader, TableRow, - TableRowLink + TableRowLink, + TableCellHeadCheck, + TableCellCheck } from '$lib/elements/table'; import { toLocaleDate } from '$lib/helpers/date'; import { @@ -56,6 +59,7 @@ let showDelete = false; let showDropdown = []; let selectedFile: Models.File = null; + let selected: string[] = []; const projectId = $page.params.project; const bucketId = $page.params.bucket; @@ -143,6 +147,9 @@ {#if data.files.total} + f.$id)} /> Filename Type Size @@ -186,6 +193,7 @@ {:else} +
@@ -267,8 +275,50 @@ target="file" on:click={() => wizard.start(Create)} /> {/if} + + 0}> +
+
+ {selected.length} +

+ + file{selected.length > 1 ? 's' : ''} + + selected +

+
+ +
+ + +
+
+
-{#if selectedFile} - -{/if} + + + diff --git a/src/routes/(console)/project-[project]/storage/bucket-[bucket]/deleteFile.svelte b/src/routes/(console)/project-[project]/storage/bucket-[bucket]/deleteFile.svelte index 6c2239ad2d..daab29b895 100644 --- a/src/routes/(console)/project-[project]/storage/bucket-[bucket]/deleteFile.svelte +++ b/src/routes/(console)/project-[project]/storage/bucket-[bucket]/deleteFile.svelte @@ -7,20 +7,26 @@ import type { Models } from '@appwrite.io/console'; import { createEventDispatcher } from 'svelte'; - export let file: Models.File; + export let singleFile: Models.File; + export let multipleFiles: string[]; export let showDelete = false; + export let bucketId: string; const dispatch = createEventDispatcher(); const deleteFile = async () => { + const promises = !singleFile + ? multipleFiles.map((fileId) => sdk.forProject.storage.deleteFile(bucketId, fileId)) + : [await sdk.forProject.storage.deleteFile(bucketId, singleFile.$id)]; + showDelete = false; try { - await sdk.forProject.storage.deleteFile(file.bucketId, file.$id); - showDelete = false; - dispatch('deleted', file); + await Promise.all(promises); + dispatch('deleted'); addNotification({ type: 'success', - message: `${file.name} has been deleted` + message: `${!singleFile ? multipleFiles.length : singleFile.name} has been deleted` }); + multipleFiles = []; trackEvent(Submit.FileDelete); } catch (error) { addNotification({ @@ -39,7 +45,11 @@ icon="exclamation" state="warning" headerDivider={false}> -

Are you sure you want to delete {file.name}?

+

+ Are you sure you want to delete {!singleFile ? `${multipleFiles.length} file${multipleFiles.length > 1 ? 's' : ''}` : singleFile.name}? +