diff --git a/src/routes/console/project-[project]/databases/database/[database]/collection/[collection]/attributes/_boolean.svelte b/src/routes/console/project-[project]/databases/database/[database]/collection/[collection]/attributes/boolean.svelte
similarity index 100%
rename from src/routes/console/project-[project]/databases/database/[database]/collection/[collection]/attributes/_boolean.svelte
rename to src/routes/console/project-[project]/databases/database/[database]/collection/[collection]/attributes/boolean.svelte
diff --git a/src/routes/console/project-[project]/databases/database/[database]/collection/[collection]/_createAttribute.svelte b/src/routes/console/project-[project]/databases/database/[database]/collection/[collection]/attributes/createAttribute.svelte
similarity index 93%
rename from src/routes/console/project-[project]/databases/database/[database]/collection/[collection]/_createAttribute.svelte
rename to src/routes/console/project-[project]/databases/database/[database]/collection/[collection]/attributes/createAttribute.svelte
index f1279afdd..d76e4eec6 100644
--- a/src/routes/console/project-[project]/databases/database/[database]/collection/[collection]/_createAttribute.svelte
+++ b/src/routes/console/project-[project]/databases/database/[database]/collection/[collection]/attributes/createAttribute.svelte
@@ -1,9 +1,9 @@
+
+
diff --git a/src/routes/console/project-[project]/databases/database/[database]/collection/[collection]/indexes/+page.svelte b/src/routes/console/project-[project]/databases/database/[database]/collection/[collection]/indexes/+page.svelte
index 03054654d..28660c810 100644
--- a/src/routes/console/project-[project]/databases/database/[database]/collection/[collection]/indexes/+page.svelte
+++ b/src/routes/console/project-[project]/databases/database/[database]/collection/[collection]/indexes/+page.svelte
@@ -15,9 +15,9 @@
import { Container } from '$lib/layout';
import { indexList, collection } from '../store';
import { onMount } from 'svelte';
- import Delete from '../_deleteIndex.svelte';
- import Create from '../_createIndex.svelte';
- import Overview from '../_overviewIndex.svelte';
+ import Delete from './deleteIndex.svelte';
+ import Create from './createIndex.svelte';
+ import Overview from './overviewIndex.svelte';
import type { Models } from '@aw-labs/appwrite-console';
let showDropdown = [];
diff --git a/src/routes/console/project-[project]/databases/database/[database]/collection/[collection]/_createIndex.svelte b/src/routes/console/project-[project]/databases/database/[database]/collection/[collection]/indexes/createIndex.svelte
similarity index 99%
rename from src/routes/console/project-[project]/databases/database/[database]/collection/[collection]/_createIndex.svelte
rename to src/routes/console/project-[project]/databases/database/[database]/collection/[collection]/indexes/createIndex.svelte
index 8d100c1ca..c184a80ad 100644
--- a/src/routes/console/project-[project]/databases/database/[database]/collection/[collection]/_createIndex.svelte
+++ b/src/routes/console/project-[project]/databases/database/[database]/collection/[collection]/indexes/createIndex.svelte
@@ -1,8 +1,8 @@
+
+
+ Create document data
+
+ Provide document data based on attributes you created earlier.
+
+
+ {#if $createDocument.attributes.length}
+
+ {/if}
+
diff --git a/src/routes/console/project-[project]/databases/database/[database]/collection/[collection]/wizard/step2.svelte b/src/routes/console/project-[project]/databases/database/[database]/collection/[collection]/wizard/step2.svelte
new file mode 100644
index 000000000..d77185aa1
--- /dev/null
+++ b/src/routes/console/project-[project]/databases/database/[database]/collection/[collection]/wizard/step2.svelte
@@ -0,0 +1,37 @@
+
+
+
+ Set Permissions
+
+ Assign read or write permissions at the Collection Level or
+ Document Level. If collection Level permissions are assigned, permissions applied to
+ individual documents are ignored.
+
+
+
+ You have Collection Level permissions enabled
+
+
+ If you want to assign permissions specific to this document, you will need to update
+ your Collection Settings to enable Document Level permissions.
+
+
+
+
+
diff --git a/src/routes/console/project-[project]/databases/database/[database]/collection/[collection]/wizard/store.ts b/src/routes/console/project-[project]/databases/database/[database]/collection/[collection]/wizard/store.ts
new file mode 100644
index 000000000..cfe13f700
--- /dev/null
+++ b/src/routes/console/project-[project]/databases/database/[database]/collection/[collection]/wizard/store.ts
@@ -0,0 +1,16 @@
+import { writable } from 'svelte/store';
+import type { Attributes } from '../store';
+
+export const createDocument = writable<{
+ id?: string;
+ document: object;
+ read: string[];
+ write: string[];
+ attributes: Attributes[];
+}>({
+ id: null,
+ document: {},
+ read: [],
+ write: [],
+ attributes: []
+});
diff --git a/src/routes/console/project-[project]/storage/bucket/[bucket]/+layout.svelte b/src/routes/console/project-[project]/storage/bucket/[bucket]/+layout.svelte
index f17f0239f..a1a4a0659 100644
--- a/src/routes/console/project-[project]/storage/bucket/[bucket]/+layout.svelte
+++ b/src/routes/console/project-[project]/storage/bucket/[bucket]/+layout.svelte
@@ -8,6 +8,8 @@
const bucketId = $page.params.bucket;
const path = `storage/bucket/${bucketId}`;
+ let loaded = false;
+
onMount(handle);
afterNavigate(handle);
@@ -43,6 +45,7 @@
}
]
});
+ loaded = true;
}
@@ -50,6 +53,6 @@
Appwrite - Bucket
-{#if $bucket}
+{#if $bucket && loaded}
{/if}
diff --git a/tests/unit/layout/breadcrumbs.test.ts b/tests/unit/layout/breadcrumbs.test.ts
index 876ae53a6..bd4236810 100644
--- a/tests/unit/layout/breadcrumbs.test.ts
+++ b/tests/unit/layout/breadcrumbs.test.ts
@@ -2,8 +2,6 @@ import '@testing-library/jest-dom';
import { render } from '@testing-library/svelte';
import { level, updateLayout } from '../../../src/lib/stores/layout';
import { tick } from 'svelte';
-
-/** @tsignore */
import BreadcrumbsComponent from '../../../src/lib/layout/breadcrumbs.svelte';
test('shows relevant breadcrumbs', async () => {
diff --git a/tests/unit/layout/wizard.test.ts b/tests/unit/layout/wizard.test.ts
new file mode 100644
index 000000000..f0aa058f6
--- /dev/null
+++ b/tests/unit/layout/wizard.test.ts
@@ -0,0 +1,80 @@
+import '@testing-library/jest-dom';
+import { render } from '@testing-library/svelte';
+import { wizard } from '../../../src/lib/stores/wizard';
+import { tick } from 'svelte';
+import WizardComponent from '../../../src/lib/mock/wizard.test.svelte';
+import WizardContainer from '../../../src/lib/mock/wizard.container.test.svelte';
+
+test('shows wizard and hides it', async () => {
+ const { queryByText } = render(WizardContainer);
+
+ /**
+ * Wizard is hidden before started.
+ */
+ expect(queryByText('wizard-title')).not.toBeInTheDocument();
+ expect(queryByText('step-1')).not.toBeInTheDocument();
+ expect(queryByText('sub-title-1')).not.toBeInTheDocument();
+ expect(queryByText('step-2')).not.toBeInTheDocument();
+ expect(queryByText('sub-title-2')).not.toBeInTheDocument();
+
+ wizard.start(WizardComponent);
+ await tick();
+
+ /**
+ * First step is shown, second is hidden.
+ */
+ expect(queryByText('wizard-title')).toBeInTheDocument();
+ expect(queryByText('step-1')).toBeInTheDocument();
+ expect(queryByText('sub-title-1')).toBeInTheDocument();
+
+ expect(queryByText('step-2')).not.toBeInTheDocument();
+ expect(queryByText('sub-title-2')).not.toBeInTheDocument();
+
+ wizard.hide();
+ await tick();
+
+ /**
+ * Wizard is hidden.
+ */
+ expect(queryByText('wizard-title')).not.toBeInTheDocument();
+ expect(queryByText('step-1')).not.toBeInTheDocument();
+ expect(queryByText('sub-title-1')).not.toBeInTheDocument();
+ expect(queryByText('step-2')).not.toBeInTheDocument();
+ expect(queryByText('sub-title-2')).not.toBeInTheDocument();
+});
+
+test('shows next step with submit', async () => {
+ const { getByTestId, getByRole, queryByText } = render(WizardContainer);
+
+ wizard.start(WizardComponent);
+ await tick();
+
+ const form = getByRole('form') as HTMLFormElement;
+ const step1 = queryByText('step-1');
+ const step1Required = getByTestId('step-1-required');
+ const step1Optional = getByTestId('step-1-optional');
+
+ expect(step1).toBeInTheDocument();
+ expect(step1Required).toBeInTheDocument();
+ expect(step1Optional).toBeInTheDocument();
+
+ form.submit();
+ await tick();
+
+ expect(step1).not.toBeInTheDocument();
+
+ const step2 = queryByText('step-2');
+ const step2First = getByTestId('step-2-first');
+ const step2Second = getByTestId('step-2-second');
+
+ expect(step2).toBeInTheDocument();
+ expect(step2First).toBeInTheDocument();
+ expect(step2Second).toBeInTheDocument();
+
+ form.submit();
+ await tick();
+
+ expect(form).not.toBeInTheDocument();
+ expect(step1).not.toBeInTheDocument();
+ expect(step2).not.toBeInTheDocument();
+});