+
{/if}
diff --git a/src/lib/constants.ts b/src/lib/constants.ts
index ccdf6c6a09..e2bb2fb6f9 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 1a2e91a3b1..dff27da836 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 458baaa62b..f453cd26ef 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'}?
+
+
+
+
+
+
+
+
From 8d8d690fe1bd1dac00c6dff53fce8adf18dcc6d9 Mon Sep 17 00:00:00 2001
From: tglide <26071571+TGlide@users.noreply.github.com>
Date: Fri, 28 Jul 2023 21:35:59 +0100
Subject: [PATCH 4/7] feat: document bulk deletion
---
src/lib/elements/table/tableScroll.svelte | 3 +-
.../collection-[collection]/table.svelte | 186 +++++++++++++++++-
2 files changed, 187 insertions(+), 2 deletions(-)
diff --git a/src/lib/elements/table/tableScroll.svelte b/src/lib/elements/table/tableScroll.svelte
index 814fe00e51..7a4017c0a6 100644
--- a/src/lib/elements/table/tableScroll.svelte
+++ b/src/lib/elements/table/tableScroll.svelte
@@ -2,6 +2,7 @@
import type { Action } from 'svelte/action';
export let isSticky = false;
+ export let noMargin = false;
const hasOverflow: Action
void> = (node, callback) => {
const observer = new ResizeObserver((entries) => {
@@ -22,7 +23,7 @@
let isOverflowing = false;
-