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 index c913f4c06..a2ab21070 100644 --- 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 @@ -1,59 +1,43 @@ + + - - Indicate whether this is a required attribute - - Indicate whether this attribute should act as an array + bind:value={data.default} + disabled={!!selectedAttribute || data.array || data.required} /> + + Indicate whether this is a required attribute + + + Indicate whether this attribute should act as an array + diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/datetime.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/datetime.svelte index 50698fefd..bd79b6643 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/datetime.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/datetime.svelte @@ -1,69 +1,54 @@ + + - - Indicate whether this is a required attribute - - Indicate whether this attribute should act as an array + bind:value={data.default} + disabled={data.required} + readonly={!!selectedAttribute} /> + + Indicate whether this is a required attribute + + + Indicate whether this attribute should act as an array + diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/email.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/email.svelte index 4c3392997..6e5d4d13e 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/email.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/email.svelte @@ -1,70 +1,59 @@ - - let xdefault: string, - required = false, - array = false; + - - Indicate whether this is a required attribute - - Indicate whether this attribute should act as an array + bind:value={data.default} + disabled={data.required} + readonly={!!selectedAttribute} /> + + Indicate whether this is a required attribute + + + Indicate whether this attribute should act as an array + diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/enum.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/enum.svelte index 47624e2ce..52a45d972 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/enum.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/enum.svelte @@ -1,81 +1,73 @@ + + + readonly={!!selectedAttribute} /> - - Indicate whether this is a required attribute - - Indicate whether this attribute should act as an array + bind:value={data.default} + disabled={!!selectedAttribute || data.required} /> + + Indicate whether this is a required attribute + + + Indicate whether this attribute should act as an array + diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/float.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/float.svelte index b9a37d60d..3686eead7 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/float.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/float.svelte @@ -1,79 +1,76 @@ - - - + + + + - - Indicate whether this is a required attribute - - Indicate whether this attribute should act as an array + + Indicate whether this is a required attribute + + + Indicate whether this attribute should act as an array + diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/integer.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/integer.svelte index 14c52af02..4c8c75f3c 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/integer.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/integer.svelte @@ -1,77 +1,74 @@ - - - + + + + - - Indicate whether this is a required attribute - - Indicate whether this attribute should act as an array + min={data.min} + max={data.max} + bind:value={data.default} + disabled={data.required || data.array} + readonly={!!selectedAttribute} /> + + Indicate whether this is a required attribute + + + Indicate whether this attribute should act as an array + diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/ip.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/ip.svelte index ed7250ab9..154be4e57 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/ip.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/ip.svelte @@ -1,68 +1,55 @@ + + - - Indicate whether this is a required attribute - - Indicate whether this attribute should act as an array + bind:value={data.default} + disabled={data.required || data.array} + readonly={!!selectedAttribute} /> + + Indicate whether this is a required attribute + + + Indicate whether this attribute should act as an array + diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/store.ts b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/store.ts index 5f3e1da7c..c8faf10e9 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/store.ts +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/store.ts @@ -1,19 +1,26 @@ import type { SvelteComponent } from 'svelte'; import { writable } from 'svelte/store'; -import Boolean from './boolean.svelte'; -import Email from './email.svelte'; -import Enum from './enum.svelte'; -import Float from './float.svelte'; -import Integer from './integer.svelte'; -import Ip from './ip.svelte'; -import String from './string.svelte'; -import Url from './url.svelte'; -import Datetime from './datetime.svelte'; +import Boolean, { submitBoolean } from './boolean.svelte'; +import Email, { submitEmail } from './email.svelte'; +import Enum, { submitEnum } from './enum.svelte'; +import Float, { submitFloat } from './float.svelte'; +import Integer, { submitInteger } from './integer.svelte'; +import Ip, { submitIp } from './ip.svelte'; +import String, { submitString } from './string.svelte'; +import Url, { submitUrl } from './url.svelte'; +import Datetime, { submitDatetime } from './datetime.svelte'; +import type { Attributes } from '../store'; export type Option = { name: string; component: typeof SvelteComponent; type: 'string' | 'integer' | 'double' | 'boolean' | 'datetime'; + func: ( + databaseId: string, + collectionId: string, + key: string, + data: Partial + ) => Promise; format?: 'email' | 'ip' | 'url' | 'enum'; }; @@ -21,51 +28,60 @@ export const options: Option[] = [ { name: 'String', component: String, - type: 'string' + type: 'string', + func: submitString }, { name: 'Integer', component: Integer, - type: 'integer' + type: 'integer', + func: submitInteger }, { name: 'Float', component: Float, - type: 'double' + type: 'double', + func: submitFloat }, { name: 'Boolean', component: Boolean, - type: 'boolean' + type: 'boolean', + func: submitBoolean }, { name: 'Datetime', component: Datetime, - type: 'datetime' + type: 'datetime', + func: submitDatetime }, { name: 'Email', component: Email, type: 'string', - format: 'email' + format: 'email', + func: submitEmail }, { name: 'IP', component: Ip, type: 'string', - format: 'ip' + format: 'ip', + func: submitIp }, { name: 'URL', component: Url, type: 'string', - format: 'url' + format: 'url', + func: submitUrl }, { name: 'Enum', component: Enum, type: 'string', - format: 'enum' + format: 'enum', + func: submitEnum } ]; diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/string.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/string.svelte index 27764415c..9ecc9c513 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/string.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/string.svelte @@ -1,72 +1,73 @@ - - + + + - - Indicate whether this is a required attribute - - Indicate whether this attribute should act as an array + bind:value={data.default} + maxlength={data.size} + disabled={data.required || data.array} + readonly={!!selectedAttribute} /> + + Indicate whether this is a required attribute + + + Indicate whether this attribute should act as an array + diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/url.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/url.svelte index f30452f55..d8fd01633 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/url.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/url.svelte @@ -1,68 +1,55 @@ + + - - Indicate whether this is a required attribute - - Indicate whether this attribute should act as an array + bind:value={data.default} + disabled={data.required || data.array} + readonly={!!selectedAttribute} /> + + Indicate whether this is a required attribute + + + Indicate whether this attribute should act as an array + 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]/createAttribute.svelte index bfffd77aa..c4fe7b59f 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]/createAttribute.svelte @@ -2,19 +2,46 @@ import { Modal } from '$lib/components'; import { option, options } from './attributes/store'; import { Button, InputText, FormList, InputSelect } from '$lib/elements/forms'; - import { invalidate } from '$app/navigation'; + import { goto, invalidate } from '$app/navigation'; import { Dependencies } from '$lib/constants'; + import { page } from '$app/stores'; + import { addNotification } from '$lib/stores/notifications'; + import { base } from '$app/paths'; + import type { Attributes } from './store'; export let showCreate = false; let key: string = null; let selectedOption = null; - let submitted = false; - - const created = async () => { - invalidate(Dependencies.COLLECTION); - showCreate = false; + let data: Partial = { + required: false, + array: false, + default: null }; + const databaseId = $page.params.database; + const collectionId = $page.params.collection; + + async function submit() { + try { + await $option.func(databaseId, collectionId, key, data); + invalidate(Dependencies.COLLECTION); + if (!$page.url.pathname.includes('attributes')) { + goto( + `${base}/console/project-${$page.params.project}/databases/database-${databaseId}/collection-${collectionId}/attributes` + ); + } + addNotification({ + type: 'success', + message: `Attribute ${key} has been created` + }); + showCreate = false; + } catch (error) { + addNotification({ + type: 'error', + message: error.message + }); + } + } $: if (selectedOption) { $option = options.find((option) => option.name === selectedOption); @@ -23,11 +50,11 @@ $: if (!showCreate) { key = null; selectedOption = null; - submitted = false; + $option = null; } - (submitted = true)}> + Create Attribute
@@ -59,9 +86,7 @@ {#if selectedOption} ($option = null)} /> {/if} diff --git a/src/routes/console/project-[project]/overview/keys/[key]/+page.ts b/src/routes/console/project-[project]/overview/keys/[key]/+page.ts index 11847cc4a..62c8a4fdb 100644 --- a/src/routes/console/project-[project]/overview/keys/[key]/+page.ts +++ b/src/routes/console/project-[project]/overview/keys/[key]/+page.ts @@ -7,9 +7,14 @@ import type { PageLoad } from './$types'; export const load: PageLoad = async ({ params, depends }) => { depends(Dependencies.KEY); + const key = await sdkForConsole.projects.getKey(params.project, params.key); + if (key.expire) { + key.expire = new Date(key.expire).toISOString().slice(0, 23); + } + return { header: Header, breadcrumbs: Breadcrumbs, - key: await sdkForConsole.projects.getKey(params.project, params.key) + key }; }; diff --git a/src/routes/console/project-[project]/overview/keys/wizard/step1.svelte b/src/routes/console/project-[project]/overview/keys/wizard/step1.svelte index 3637cd145..37fb03702 100644 --- a/src/routes/console/project-[project]/overview/keys/wizard/step1.svelte +++ b/src/routes/console/project-[project]/overview/keys/wizard/step1.svelte @@ -1,7 +1,45 @@ @@ -14,6 +52,38 @@ placeholder="API Key Name" required bind:value={$key.name} /> - + + {#if preset === 'custom'} + + {/if} diff --git a/src/routes/console/project-[project]/settings/+page.svelte b/src/routes/console/project-[project]/settings/+page.svelte index e2c73599f..d78f84f0b 100644 --- a/src/routes/console/project-[project]/settings/+page.svelte +++ b/src/routes/console/project-[project]/settings/+page.svelte @@ -67,6 +67,21 @@ {#if $project}
+ + API Credentials +

Access Appwrite services using your API Endpoint and Project ID.

+ + + + + + + + + +
Update Name @@ -87,29 +102,6 @@
- - API Credentials -

- Access Appwrite services using your API Endpoint and Project ID. You can connect - Appwrite to your applications and server-side code by integrating a new platform - or - creating an API key. -

- - - - - - - - - -
- Services

Choose services you wish to enable or disable.

diff --git a/src/routes/console/project-[project]/settings/webhooks/[webhook]/+page.svelte b/src/routes/console/project-[project]/settings/webhooks/[webhook]/+page.svelte index ed7f2ecff..dcde9a658 100644 --- a/src/routes/console/project-[project]/settings/webhooks/[webhook]/+page.svelte +++ b/src/routes/console/project-[project]/settings/webhooks/[webhook]/+page.svelte @@ -153,7 +153,14 @@ Signature Key -

You can use the Signature Key to validate your webhooks.

+

+ Add the Signature Key to the X-Appwrite-Webhook-Signature header to validate your + webhooks. Learn more about webhook validation. +

Key

diff --git a/src/routes/console/project-[project]/storage/[[page]]/+page.svelte b/src/routes/console/project-[project]/storage/[[page]]/+page.svelte index f89a38592..c8ba9b82b 100644 --- a/src/routes/console/project-[project]/storage/[[page]]/+page.svelte +++ b/src/routes/console/project-[project]/storage/[[page]]/+page.svelte @@ -39,7 +39,6 @@ on:click={() => (showCreate = true)}> {#each data.buckets.buckets as bucket} - XX Files {bucket.name} {#if !bucket.enabled}