From 8c7bcbe56f1d71050bc5d7bbb396e58a797b9b17 Mon Sep 17 00:00:00 2001 From: Arman Date: Thu, 6 Apr 2023 14:13:48 +0200 Subject: [PATCH] fix: QA - index can't be created from rel attr --- .../attributes/+page.svelte | 21 ++++++++++--------- .../indexes/createIndex.svelte | 11 ++++++---- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/+page.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/+page.svelte index 7bc1e6381..68e7abaa3 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/+page.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/+page.svelte @@ -144,16 +144,17 @@ }}> Edit - - { - selectedAttribute = attribute; - showCreateIndex = true; - showDropdown[index] = false; - }}> - Create Index - + {#if !isRelationship(attribute)} + { + selectedAttribute = attribute; + showCreateIndex = true; + showDropdown[index] = false; + }}> + Create Index + + {/if} { diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/indexes/createIndex.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/indexes/createIndex.svelte index 5528ddee2..3bf7b6776 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/indexes/createIndex.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/indexes/createIndex.svelte @@ -9,6 +9,7 @@ import { remove } from '$lib/helpers/array'; import { addNotification } from '$lib/stores/notifications'; import { sdk } from '$lib/stores/sdk'; + import { isRelationship } from '../document-[document]/attributes/store'; import { indexes, type Attributes } from '../store'; import { collection } from '../store'; import Select from './select.svelte'; @@ -27,10 +28,12 @@ ]; let selectedType = 'key'; - let attributeOptions = $collection.attributes.map((attribute: Attributes) => ({ - value: attribute.key, - label: attribute.key - })); + let attributeOptions = $collection.attributes + .filter((attribute) => !isRelationship(attribute)) + .map((attribute) => ({ + value: attribute.key, + label: attribute.key + })); let attributeList = [{ value: '', order: '' }];