This commit is contained in:
Martin McKeaveney 2021-02-25 16:21:41 +00:00
parent 6a0c80da58
commit 0cfbe2357b
4 changed files with 26 additions and 15 deletions

View File

@ -28,10 +28,8 @@
.flat()
// Prevent modal closing if there were errors
return false
}
if (rowResponse.status === 500) {
notifier.danger(rowResponse.message)
} else if (rowResponse.status === 400 || rowResponse.status === 500) {
errors = [{ message: rowResponse.message }]
return false
}

View File

@ -60,7 +60,7 @@
.flat()
}
return false
} else if (rowResponse.status === 400 && rowResponse.message) {
} else if (rowResponse.status === 400 || rowResponse.status === 500) {
errors = [{ message: rowResponse.message }]
return false
}

View File

@ -43,16 +43,6 @@
</Label>
{:else}
{#if schema.relationshipType === 'one-to-many'}
<Multiselect
secondary
bind:value={linkedIds}
{label}
placeholder="Choose some options">
{#each rows as row}
<option value={row._id}>{getPrettyName(row)}</option>
{/each}
</Multiselect>
{:else}
<Select
thin
secondary
@ -66,5 +56,15 @@
</option>
{/each}
</Select>
{:else}
<Multiselect
secondary
bind:value={linkedIds}
{label}
placeholder="Choose some options">
{#each rows as row}
<option value={row._id}>{getPrettyName(row)}</option>
{/each}
</Multiselect>
{/if}
{/if}

View File

@ -322,9 +322,22 @@ class LinkController {
tableId: table._id,
fieldName: fieldName,
}
if (field.autocolumn) {
linkConfig.autocolumn = field.autocolumn
}
if (field.relationshipType) {
// Ensure that the other side of the relationship is locked to one record
linkConfig.relationshipType = field.relationshipType
// Update this table to be the many
table.schema[field.name].relationshipType =
RelationshipTypes.MANY_TO_MANY
const response = await this._db.put(table)
table._rev = response.rev
}
// check the linked table to make sure we aren't overwriting an existing column
const existingSchema = linkedTable.schema[field.fieldName]
if (