Skip to content

Commit 356d9c4

Browse files
committed
fix: spacing and update being broken.
1 parent eaf8fc8 commit 356d9c4

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/+page.svelte

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,16 @@
137137
{#if 'format' in attribute && attribute.format}
138138
<span class="u-capitalize">{attribute.format}</span>
139139
{:else}
140-
<span class="u-capitalize">{attribute.type}</span>
141-
{#if isRelationship(attribute)}
142-
<span>
143-
with <a
144-
href={`${base}/project-${page.params.region}-${page.params.project}/databases/database-${databaseId}/collection-${attribute?.relatedCollection}`}
145-
><b data-private>{attribute?.key}</b></a>
146-
</span>
147-
{/if}
140+
<p>
141+
<span class="u-capitalize">{attribute.type}</span>
142+
{#if isRelationship(attribute)}
143+
<span>
144+
with <a
145+
href={`${base}/project-${page.params.region}-${page.params.project}/databases/database-${databaseId}/collection-${attribute?.relatedCollection}`}
146+
><b data-private>{attribute?.key}</b></a>
147+
</span>
148+
{/if}
149+
</p>
148150
{/if}
149151
<span>
150152
{attribute.array ? '[]' : ''}
@@ -171,8 +173,8 @@
171173
<ActionMenu.Item.Button
172174
leadingIcon={IconPencil}
173175
on:click={() => {
174-
selectedAttribute = attribute;
175176
showEdit = true;
177+
selectedAttribute = attribute;
176178
showDropdown[index] = false;
177179
}}>
178180
Update

src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/relationship.svelte

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111
data: Partial<Models.AttributeRelationship>
1212
) {
1313
if (!isValueOfStringEnum(RelationshipType, data.relationType)) {
14-
throw new Error(`Invalid relationship type: ${data.relationType}`);
14+
throw new Error(
15+
`Invalid relationship type${data.relationType ? ` : ${data.relationType}` : ''}`
16+
);
1517
}
1618
if (!isValueOfStringEnum(RelationMutate, data.onDelete)) {
17-
throw new Error(`Invalid on delete: ${data.onDelete}`);
19+
throw new Error(`Invalid deletion method${data.onDelete ? ` : ${data.onDelete}` : ''}`);
1820
}
1921
2022
await sdk
@@ -137,7 +139,7 @@
137139
$: search = data.relatedCollection || undefined;
138140
139141
$: if (search) {
140-
const exists = collectionList.collections?.some((c) =>
142+
const exists = collectionList?.collections?.some((c) =>
141143
c.$id.toLocaleLowerCase().includes(search.toLocaleLowerCase())
142144
);
143145
@@ -157,17 +159,15 @@
157159
name="one"
158160
value="one"
159161
icon={IconArrowSmRight}>
160-
<p>One Relation attribute within this collection</p>
162+
One Relation attribute within this collection
161163
</Card.Selector>
162164
<Card.Selector
163165
title="Two-way relationship"
164166
bind:group={way}
165167
name="two"
166168
value="two"
167169
icon={IconSwitchHorizontal}>
168-
<p>
169-
One Relation attribute within this collection and another within the related collection
170-
</p>
170+
One Relation attribute within this collection and another within the related collection
171171
</Card.Selector>
172172
</Layout.Stack>
173173

@@ -179,6 +179,7 @@
179179
bind:value={data.relatedCollection}
180180
on:change={updateKeyName}
181181
options={collections?.map((n) => ({ value: n.$id, label: `${n.name} (${n.$id})` })) ?? []} />
182+
182183
{#if data?.relatedCollection}
183184
<InputText
184185
id="key"
@@ -207,14 +208,15 @@
207208
placeholder="Select a relation"
208209
options={relationshipType}
209210
disabled={editing} />
211+
210212
<div class="u-flex u-flex-vertical u-gap-16">
211213
<Box>
212214
<div class="u-flex u-align u-cross-center u-main-center u-gap-32">
213215
<span data-private>{camelize($collection.name)}</span>
214216
{#if data.twoWay}
215217
<img src={arrowTwo} alt={'Two way relationship'} />
216218
{:else}
217-
<img src={arrowOne} alt={'One way realationship'} />
219+
<img src={arrowOne} alt={'One way relationship'} />
218220
{/if}
219221
<span>{data.key}</span>
220222
</div>

0 commit comments

Comments
 (0)