diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/document-[document]/+page.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/document-[document]/+page.svelte index 103f9a8b2..31db52abd 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/document-[document]/+page.svelte +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/document-[document]/+page.svelte @@ -20,7 +20,6 @@ const databaseId = page.params.database; const collectionId = page.params.collection; const documentId = page.params.document; - const editing = true; function initWork() { const prohibitedKeys = [ @@ -124,7 +123,7 @@ {label} - + diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/document-[document]/attributes/relationship.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/document-[document]/attributes/relationship.svelte index af18757b5..e63977b1b 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/document-[document]/attributes/relationship.svelte +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/document-[document]/attributes/relationship.svelte @@ -1,24 +1,22 @@ {#if isRelationshipToMany(attribute)} - - - - {label} - - {optionalText} - + + + + + {label} + + {optionalText} + + + + {#if showTopAddButton} + (showInput = true)}> + + Add item + + {/if} - {#if editing || total === 0} - { - showInput = true; - }}> - - Add item - + + + + {#if showEmptyInput} + + { + if (!relatedList[0]) relatedList = ['']; + updateRelatedList(); + }} /> + + {/if} + + + {#if editing && hasItems} + {#each paginatedItems as _, paginatedIndex} + {@const actualIndex = offset + paginatedIndex} + + + {#if relatedList[actualIndex]} + + removeItem(actualIndex)}> + + + + {/if} + + {/each} + {/if} + + + {#if !editing && hasItems} + {#each relatedList as item, i} + + + + { + relatedList.splice(i, 1); + updateRelatedList(); + }}> + + + + + {/each} + {/if} + + + {#if showInput} + + + + + + + + + {/if} + + + {#if showBottomAddButton} + + (showInput = true)}> + + Add item + + {/if} - - {#if !editing && relatedList?.length} - {#each relatedList as item, i} - - { - relatedList.splice(i, 1); - relatedList = relatedList; - value = relatedList; - }}> - - - {/each} - {/if} - - {#if showInput} - !relatedList.includes(n.value))} - on:change={() => { - value = relatedList; - showInput = false; - }} /> - (showInput = false)}> - - - {/if} - {#if paginatedItems && editing} - {#each paginatedItems as item, i} - - { - relatedList.splice(i, 1); - relatedList = relatedList; - value = relatedList; - }}> - - - {/each} - {/if} - - {#if editing} - - Total results: {total} - - - {/if} - - {#if total > 0 && !editing} - { - showInput = true; - }}> - - Add item - - {/if} - + {:else}
Total results: {total}