From 90033933de7f491299d7c8e6c26afc03e3e3ca01 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Mon, 23 Sep 2024 14:39:12 +0200 Subject: [PATCH] fix: update attributes --- .../attributes/boolean.svelte | 2 +- .../attributes/datetime.svelte | 2 +- .../attributes/edit.svelte | 16 ++++++++++------ .../attributes/email.svelte | 2 +- .../attributes/enum.svelte | 2 +- .../attributes/float.svelte | 2 +- .../attributes/integer.svelte | 2 +- .../collection-[collection]/attributes/ip.svelte | 2 +- .../attributes/url.svelte | 2 +- 9 files changed, 18 insertions(+), 14 deletions(-) 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 34cf6fae1..fffeef5a5 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 @@ -26,7 +26,7 @@ await sdk.forProject.databases.updateBooleanAttribute( databaseId, collectionId, - data.key, + originalKey, data.required, data.default, data.key !== originalKey ? data.key : undefined 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 a2cd24a12..94d53f1e2 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 @@ -27,7 +27,7 @@ await sdk.forProject.databases.updateDatetimeAttribute( databaseId, collectionId, - data.key, + originalKey, data.required, data.default, data.key !== originalKey ? data.key : undefined diff --git a/src/routes/(console)/project-[project]/databases/database-[database]/collection-[collection]/attributes/edit.svelte b/src/routes/(console)/project-[project]/databases/database-[database]/collection-[collection]/attributes/edit.svelte index a42c7d890..dc8ffbbdd 100644 --- a/src/routes/(console)/project-[project]/databases/database-[database]/collection-[collection]/attributes/edit.svelte +++ b/src/routes/(console)/project-[project]/databases/database-[database]/collection-[collection]/attributes/edit.svelte @@ -52,12 +52,16 @@ } } - $: if (showEdit) { - currentAttr ??= { ...selectedAttribute }; - originalKey = currentAttr.key; - error = null; - } else { - currentAttr = null; + $: onShow(showEdit); + + function onShow(show: boolean) { + if (show) { + currentAttr ??= { ...selectedAttribute }; + originalKey = currentAttr.key; + error = null; + } else { + currentAttr = null; + } } 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 d7a606fd5..9f9f75726 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 @@ -28,7 +28,7 @@ await sdk.forProject.databases.updateEmailAttribute( databaseId, collectionId, - data.key, + originalKey, data.required, data.default, data.key !== originalKey ? data.key : undefined 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 a8fce3f17..a9cb99c02 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 @@ -28,7 +28,7 @@ await sdk.forProject.databases.updateEnumAttribute( databaseId, collectionId, - data.key, + originalKey, data.elements, data.required, data.default, 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 065ac2ecb..880fc9ab4 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 @@ -29,7 +29,7 @@ await sdk.forProject.databases.updateFloatAttribute( databaseId, collectionId, - data.key, + originalKey, data.required, data.min, data.max, 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 532a60222..86c676800 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 @@ -29,7 +29,7 @@ await sdk.forProject.databases.updateIntegerAttribute( databaseId, collectionId, - data.key, + originalKey, data.required, data.min, data.max, 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 115deac83..46b9c904c 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 @@ -26,7 +26,7 @@ await sdk.forProject.databases.updateIpAttribute( databaseId, collectionId, - data.key, + originalKey, data.required, data.default, data.key !== originalKey ? data.key : undefined 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 939410756..b058a56b2 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 @@ -27,7 +27,7 @@ await sdk.forProject.databases.updateUrlAttribute( databaseId, collectionId, - data.key, + originalKey, data.required, data.default, data.key !== originalKey ? data.key : undefined