diff --git a/src/lib/components/index.ts b/src/lib/components/index.ts index a12f60ea5..ca0b9fe35 100644 --- a/src/lib/components/index.ts +++ b/src/lib/components/index.ts @@ -4,6 +4,8 @@ export { default as InputPassword } from './inputPassword.svelte'; export { default as InputText } from './inputText.svelte'; export { default as InputNumber } from './inputNumber.svelte'; export { default as InputBoolean } from './inputBoolean.svelte'; +export { default as InputTags } from './inputTags.svelte'; export { default as Modal } from './modal.svelte'; -export { default as Table } from './table.svelte'; +export { default as Table } from './table/table.svelte'; export { default as Pagination } from './pagination.svelte'; +export * from "./table"; diff --git a/src/lib/components/inputTags.svelte b/src/lib/components/inputTags.svelte new file mode 100644 index 000000000..e9fb03f8c --- /dev/null +++ b/src/lib/components/inputTags.svelte @@ -0,0 +1,110 @@ + + + + + + diff --git a/src/lib/components/table.svelte b/src/lib/components/table.svelte deleted file mode 100644 index a37787bbf..000000000 --- a/src/lib/components/table.svelte +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - {#each columns as column} - - {/each} - - - - {#each data as entry} - - {#each columns as column} - - {/each} - - {:else} - nothing found - {/each} - - - - -
{column.title}
- {#if anchor} - - {entry[column.key] ?? 'n/a'} - - {:else} - {entry[column.key] ?? 'n/a'} - {/if} -
diff --git a/src/lib/components/table/body.svelte b/src/lib/components/table/body.svelte new file mode 100644 index 000000000..21a6e55eb --- /dev/null +++ b/src/lib/components/table/body.svelte @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/lib/components/table/cell.svelte b/src/lib/components/table/cell.svelte new file mode 100644 index 000000000..eabf5e512 --- /dev/null +++ b/src/lib/components/table/cell.svelte @@ -0,0 +1,9 @@ + + + + + diff --git a/src/lib/components/table/footer.svelte b/src/lib/components/table/footer.svelte new file mode 100644 index 000000000..31c10bcaa --- /dev/null +++ b/src/lib/components/table/footer.svelte @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/src/lib/components/table/header.svelte b/src/lib/components/table/header.svelte new file mode 100644 index 000000000..2514313c0 --- /dev/null +++ b/src/lib/components/table/header.svelte @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/src/lib/components/table/index.ts b/src/lib/components/table/index.ts new file mode 100644 index 000000000..87a040fa4 --- /dev/null +++ b/src/lib/components/table/index.ts @@ -0,0 +1,6 @@ +export { default as Table } from "./table.svelte"; +export { default as TableBody } from "./body.svelte"; +export { default as TableHeader } from "./header.svelte"; +export { default as TableFooter } from "./footer.svelte"; +export { default as TableCell } from "./cell.svelte"; +export { default as TableRow } from "./row.svelte"; \ No newline at end of file diff --git a/src/lib/components/table/row.svelte b/src/lib/components/table/row.svelte new file mode 100644 index 000000000..6c8e3d655 --- /dev/null +++ b/src/lib/components/table/row.svelte @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/lib/components/table/table.svelte b/src/lib/components/table/table.svelte new file mode 100644 index 000000000..6e3f1fb9f --- /dev/null +++ b/src/lib/components/table/table.svelte @@ -0,0 +1,15 @@ + + +{#if horizontalScroll} +
+ + +
+
+{:else} + + +
+{/if} diff --git a/src/routes/console/[project]/database/[collection]/attributes.svelte b/src/routes/console/[project]/database/[collection]/attributes.svelte index 6a3a46cde..027576ad1 100644 --- a/src/routes/console/[project]/database/[collection]/attributes.svelte +++ b/src/routes/console/[project]/database/[collection]/attributes.svelte @@ -1,5 +1,5 @@
- +
+ + Status + Key + Type + + + {#each $collection.attributes as attribute} + + {attribute.status} + {attribute.key} + {attribute.type} + + {/each} + +
diff --git a/src/routes/console/[project]/database/[collection]/index.svelte b/src/routes/console/[project]/database/[collection]/index.svelte index 7105ca5f6..34a66ec57 100644 --- a/src/routes/console/[project]/database/[collection]/index.svelte +++ b/src/routes/console/[project]/database/[collection]/index.svelte @@ -1,7 +1,7 @@ @@ -23,16 +26,27 @@ {#await request}
{:then response} -
- - +
+ + {#each columns as column} + {column.title} + {/each} + + + {#each response.documents as document} + + {#each columns as column} + + + {document[column.key] ?? 'n/a'} + + + {/each} + + {/each} + +
+ import { page } from '$app/stores'; import { sdkForProject } from '$lib/stores/sdk'; - import { Table, Button, Pagination } from '$lib/components'; + import { + Table, + Button, + Pagination, + TableRow, + TableBody, + TableHeader, + TableCell + } from '$lib/components'; import Create from './_create.svelte'; let search = ''; @@ -26,17 +34,22 @@ {#await request}
{:then response} - +
+ + # + Name + + + {#each response.collections as collection} + + + {collection.$id} + + {collection.name} + + {/each} + +
import Button from '$lib/components/button.svelte'; import InputFile from '$lib/components/inputFile.svelte'; +import InputTags from '$lib/components/inputTags.svelte'; import Modal from '$lib/components/modal.svelte'; import { sdkForProject } from '$lib/stores/sdk'; import { createEventDispatcher } from 'svelte'; @@ -10,10 +11,12 @@ const dispatch = createEventDispatcher(); let files: FileList; + let read: string[] = []; + let write: string[] = []; const create = async () => { try { - await sdkForProject.storage.createFile('unique()', files[0]); + await sdkForProject.storage.createFile('unique()', files[0], read, write); files = null; showCreate = false; dispatch('created'); @@ -27,6 +30,8 @@ Upload File + +