diff --git a/src/lib/components/floatingActionBar.svelte b/src/lib/components/floatingActionBar.svelte index 50ddb0fd8..5f25bad40 100644 --- a/src/lib/components/floatingActionBar.svelte +++ b/src/lib/components/floatingActionBar.svelte @@ -6,7 +6,7 @@ {#if show} -
+
{/if} diff --git a/src/lib/constants.ts b/src/lib/constants.ts index ccdf6c6a0..e2bb2fb6f 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -34,7 +34,8 @@ export enum Dependencies { DOMAINS = 'dependency:domains', WEBHOOK = 'dependency:webhook', WEBHOOKS = 'dependency:webhooks', - MIGRATIONS = 'dependency:migrations' + MIGRATIONS = 'dependency:migrations', + COLLECTIONS = 'dependency:collections' } export const scopes: { diff --git a/src/routes/console/project-[project]/databases/database-[database]/+page.ts b/src/routes/console/project-[project]/databases/database-[database]/+page.ts index 1a2e91a3b..dff27da83 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/+page.ts +++ b/src/routes/console/project-[project]/databases/database-[database]/+page.ts @@ -2,9 +2,10 @@ import { Query } from '@appwrite.io/console'; import { sdk } from '$lib/stores/sdk'; import { getLimit, getPage, getView, pageToOffset, View } from '$lib/helpers/load'; import type { PageLoad } from './$types'; -import { CARD_LIMIT } from '$lib/constants'; +import { CARD_LIMIT, Dependencies } from '$lib/constants'; -export const load: PageLoad = async ({ params, url, route }) => { +export const load: PageLoad = async ({ params, url, route, depends }) => { + depends(Dependencies.COLLECTIONS); const page = getPage(url); const limit = getLimit(url, route, CARD_LIMIT); const view = getView(url, route, View.Grid); diff --git a/src/routes/console/project-[project]/databases/database-[database]/table.svelte b/src/routes/console/project-[project]/databases/database-[database]/table.svelte index 458baaa62..f453cd26e 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/table.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/table.svelte @@ -1,7 +1,13 @@ + + 0 && selected.length < data.collections.total} + value={selected.length === data.collections.total} + on:click={(e) => { + if (!isHTMLInputElement(e.target)) return; + selected = e.target.checked + ? data.collections.collections.map((database) => database.$id) + : []; + }} /> + {#each $columns as column} {#if column.show} {column.title} @@ -32,6 +84,25 @@ {#each data.collections.collections as collection} + + { + // Prevent the link from being followed + e.preventDefault(); + const el = e.currentTarget; + if (!isHTMLInputElement(el)) return; + + selected = toggle(selected, collection.$id); + + // Hack to make sure the checkbox is checked, independent of the + // preventDefault() call above + window.setTimeout(() => { + el.checked = selected.includes(collection.$id); + }); + }} /> + {#each $columns as column} {#if column.show} {#if column.id === '$id'} @@ -55,3 +126,52 @@ {/each} + + 0}> +
+
+ {selected.length} + + {selected.length > 1 ? 'collections' : 'collection'} selected + +
+ +
+ + +
+
+
+ + + Delete Collections +

+ Are you sure you want to delete {selected.length} + {selected.length > 1 ? 'collections' : 'collection'}? +

+ + + + +
+ +